コード例 #1
0
ファイル: ExamplePluginTests.cs プロジェクト: JQ-IOWA/XrmMoq
        public void Test_plugin_2016_methodonly_trace_retrieve()
        {
            //Arrange

            //Create the plug-in mock - not need to create the context as we aren't using it
            CrmPluginMock pluginMock = new CrmPluginMock();

            //Define the entity to be returned from the Retrieve request
            Entity user = new Entity("systemuser", new Guid())
            {
                ["fullname"] = "John Smith"
            };

            //Set the Retrieve response
            pluginMock.SetMockRetrieves(user);

            //Act

            //Execute the method (which was marked Public)
            ExamplePlugin examplePlugin = new ExamplePlugin();
            string        name          = examplePlugin.RetrieveUserFullName(pluginMock.FakeOrganizationService, pluginMock.FakeTracingService, Guid.NewGuid());

            //Assert

            //Check the returned value matches the expected value being
            //returned from the method in the plug-in
            Assert.AreEqual(name, "John Smith");

            //Also check this test's output and you will see that the trace message was written
        }
コード例 #2
0
 public void TriggerExceptionCrash()
 {
     ExamplePlugin.TriggerExceptionCrash();
 }
コード例 #3
0
 public void TriggerSignalCrash()
 {
     ExamplePlugin.TriggerSignalCrash();
 }