public void SetStateInvokedWithCorrectArguments()
        {
            var entity = new Entity
            {
                Id          = Guid.NewGuid(),
                LogicalName = "contact",
                Attributes  = new AttributeCollection
                {
                    { "statecode", new OptionSetValue(1) },
                    { "statuscode", new OptionSetValue(2) }
                }
            };

            var request = new SetStateRequest();

            Service.Setup(s => s.Execute(It.IsAny <SetStateRequest>()))
            .Returns(new SetStateResponse())
            .Callback <SetStateRequest>(s => request = s);

            DataWriterService.SetEntityState(entity);

            Assert.AreEqual(new OptionSetValue(1), request.State);
            Assert.AreEqual(new OptionSetValue(2), request.Status);
            Assert.AreEqual(entity.ToEntityReference(), request.EntityMoniker);
        }
        public void SetsEntityState()
        {
            var entity = new Entity
            {
                Id          = Guid.NewGuid(),
                LogicalName = "contact",
                Attributes  = new AttributeCollection
                {
                    { "statecode", new OptionSetValue(1) },
                    { "statuscode", new OptionSetValue(2) }
                }
            };

            DataWriterService.SetEntityState(entity);

            Service.Verify(s => s.Execute(It.IsAny <SetStateRequest>()), Times.Once());
        }