Beispiel #1
0
        public void Does_Not_Call_Frozen_Account_Management_When_Frozen_Attribute_Did_Not_Change()
        {
            var pluginSetup = A.Fake <IPluginSetup>();
            var ctx         = A.Fake <IPluginExecutionContext>();

            A.CallTo(() => pluginSetup.Context).Returns(ctx);
            A.CallTo(() => pluginSetup.Helper.GetTargetEntity <CrmObject.Account>()).ReturnsLazily(() => ((Entity)pluginSetup.Context.InputParameters["Target"]).ToEntity <CrmObject.Account>());
            A.CallTo(() => ctx.ParentContext).Returns(null);

            var targetGuid = Guid.NewGuid();
            var target     = new CrmObject.Account()
            {
                Id = targetGuid,
                think_frozenEnum = CrmObject.Account_think_frozen.No
            };

            var preImage = new CrmObject.Account()
            {
                Id = targetGuid,
                think_frozenEnum = CrmObject.Account_think_frozen.No
            };

            A.CallTo(() => ctx.InputParameters)
            .Returns(new ParameterCollection {
                new KeyValuePair <string, object>("Target", target)
            });
            A.CallTo(() => ctx.PreEntityImages).Returns(new EntityImageCollection {
                { "PreImage", preImage }
            });

            var fakeFam = A.Fake <IFrozenAccountManagement>();

            var pluginObj = new FrozenFlagChangedTestHarness(fakeFam);

            pluginObj.ExecutePostOpSync(pluginSetup);

            A.CallTo(
                () =>
                fakeFam.ProcessChangedFrozenFlag(A <ICrmService> ._, A <ILogging> ._, A <CrmObject.Account> ._, A <bool> ._))
            .MustHaveHappened(Repeated.Never);
        }
Beispiel #2
0
        public void Check_For_Required_Object_Setup()
        {
            var pluginObj = new FrozenFlagChangedTestHarness(true);

            Assert.True(pluginObj.HasInjectableType <IFrozenAccountManagement>());
        }