-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnitTest1.cs
37 lines (28 loc) · 1023 Bytes
/
UnitTest1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using FakeItEasy;
using FakeXrmEasy;
using Microsoft.Xrm.Sdk;
using HSBC.CME.Plugins;
using Microsoft.Xrm.Sdk.Query;
namespace HSBC.CME.UnitTests
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void AccountPostCreateTest()
{
var fakedContext = new XrmFakedContext();
Entity account = new Entity("account");
account.Attributes.Add("name", "Unit Test");
account.Id = Guid.NewGuid();
var fakedService = fakedContext.GetOrganizationService();
fakedContext.ExecutePluginWithTarget<AccountPostCreate>(account, "Create", 40);
QueryExpression query = new QueryExpression("task");
query.ColumnSet.AddColumn("subject");
EntityCollection colletion = fakedService.RetrieveMultiple(query);
Assert.IsTrue(colletion.Entities.Count == 1);
}
}
}