public void ReturnsCloneForEntityReference()
            {
                var reference = default(EntityReference);
                var clone     = default(EntityReference);

                reference = new EntityReference();
                clone     = reference.Clone();

                Assert.IsNotNull(clone);
                Assert.AreEqual(reference.Id, clone.Id);
                Assert.AreEqual(reference.LogicalName, clone.LogicalName);

                reference = new EntityReference(Schema.AccountEntity.TypeName);
                clone     = reference.Clone();

                Assert.IsNotNull(clone);
                Assert.AreEqual(reference.Id, clone.Id);
                Assert.AreEqual(reference.LogicalName, clone.LogicalName);

                reference = new EntityReference(Schema.AccountEntity.TypeName, Guid.NewGuid());
                clone     = reference.Clone();

                Assert.IsNotNull(clone);
                Assert.AreEqual(reference.Id, clone.Id);
                Assert.AreEqual(reference.LogicalName, clone.LogicalName);
            }
Exemplo n.º 2
0
        public static SetStateResponse SetStatus(
            this IOrganizationService service, EntityReference entity, Int32 state, Int32 status)
        {
            ValidationHelper.EnsureNotNull(service);
            ValidationHelper.EnsureNotNull(entity);

            var request = new SetStateRequest
            {
                EntityMoniker = entity.Clone(),
                State         = new OptionSetValue(state),
                Status        = new OptionSetValue(status)
            };

            var response = service.Execute <SetStateResponse>(request);

            return(response);
        }