Пример #1
0
        public void TestIsValidStateTransition_FailsWhenStateCodeInvalid()
        {
            var man = new dg_man()
            {
                statecode  = dg_manState.Active,
                statuscode = dg_man_statuscode.Active
            };

            man.Id = orgAdminUIService.Create(man);

            var retrieved = orgAdminUIService.Retrieve(dg_man.EntityLogicalName, man.Id, new ColumnSet(true)) as dg_man;

            var request = new IsValidStateTransitionRequest
            {
                Entity    = retrieved.ToEntityReference(),
                NewState  = dg_manState.Active.ToString(),
                NewStatus = (int)dg_man_statuscode.Inactive
            };

            try
            {
                orgAdminUIService.Execute(request);
                Assert.Fail();
            }
            catch (Exception e)
            {
                Assert.IsInstanceOfType(e, typeof(FaultException));
            }
        }
Пример #2
0
        public void TestStatusTransitions()
        {
            var man = new dg_man()
            {
                statecode  = dg_manState.Active,
                statuscode = dg_man_statuscode.Active
            };

            man.Id = orgAdminUIService.Create(man);
            man.SetState(orgAdminUIService, dg_manState.Inactive, dg_man_statuscode.Inactive);

            var retrieved = orgAdminUIService.Retrieve(dg_man.EntityLogicalName, man.Id, new ColumnSet(true)) as dg_man;

            Assert.AreEqual(dg_manState.Inactive, retrieved.statecode);
            Assert.AreEqual(dg_man_statuscode.Inactive, retrieved.statuscode);

            try
            {
                man.SetState(orgAdminUIService, dg_manState.Active, dg_man_statuscode.Active);
                Assert.Fail();
            }
            catch (Exception e)
            {
                Assert.IsInstanceOfType(e, typeof(FaultException));
            }
        }
Пример #3
0
        public void TestIsValidStateTransition_FailsWhenNewStatusIsMissing()
        {
            var man = new dg_man()
            {
                statecode  = dg_manState.Active,
                statuscode = dg_man_statuscode.Active
            };

            man.Id = orgAdminUIService.Create(man);

            var retrieved = orgAdminUIService.Retrieve(dg_man.EntityLogicalName, man.Id, new ColumnSet(true)) as dg_man;

            var request = new IsValidStateTransitionRequest
            {
                Entity   = retrieved.ToEntityReference(),
                NewState = dg_manState.Active.ToString()
            };

            try
            {
                orgAdminUIService.Execute(request);
                throw new XunitException();
            }
            catch (Exception e)
            {
                Assert.IsType <FaultException>(e);
            }
        }
Пример #4
0
        public void TestIsValidStateTransition()
        {
            var man = new dg_man()
            {
                statecode  = dg_manState.Active,
                statuscode = dg_man_statuscode.Active
            };

            man.Id = orgAdminUIService.Create(man);

            var retrieved = orgAdminUIService.Retrieve(dg_man.EntityLogicalName, man.Id, new ColumnSet(true)) as dg_man;

            var request = new IsValidStateTransitionRequest
            {
                Entity    = retrieved.ToEntityReference(),
                NewState  = dg_manState.Inactive.ToString(),
                NewStatus = (int)dg_man_statuscode.Inactive
            };

            var response = orgAdminUIService.Execute(request) as IsValidStateTransitionResponse;

            Assert.IsTrue(response.IsValid);
        }