예제 #1
0
        public void Setup()
        {
            InitializeProperties();

            var contact = new Entity(entityName);

            contact.Attributes.Add("contactid", Guid.NewGuid());
            var account = new Entity("account");

            account.Attributes.Add("accountid", Guid.NewGuid());

            entities = new List <EntityWrapper>
            {
                new EntityWrapper(contact),
                new EntityWrapper(account)
            };
            requestResult = new ExecuteMultipleResponse()
            {
            };

            testOrgService = new TestOrganizationalService();

            testOrgService.EntityCollection.Entities.AddRange(new Entity[] { contact, account });

            systemUnderTest = new EntityRepositorySingle(testOrgService, MockRetryExecutor.Object, MockEntityMetadataCache.Object);
        }
예제 #2
0
        public void AssociateManyToManyEntity()
        {
            ManyToManyDetails details = new ManyToManyDetails
            {
                Entity1IntersectAttribute = "contactid",
                Entity2IntersectAttribute = "accountid",
                IsManyToMany = true,
                SchemaName   = "accountcontact"
            };

            MockEntityMetadataCache.Setup(a => a.GetManyToManyEntityDetails(It.IsAny <string>()))
            .Returns(details);

            testOrgService.ExecutionResponse = new AssociateResponse();

            systemUnderTest = new EntityRepositorySingle(MockOrganizationService.Object, MockRetryExecutor.Object, MockEntityMetadataCache.Object);

            var response = new UpdateResponse();

            MockOrganizationService.Setup(a => a.Execute(It.IsAny <OrganizationRequest>()))
            .Returns(response);

            FluentActions.Invoking(() => systemUnderTest.AssociateManyToManyEntity(entities))
            .Should()
            .NotThrow();

            MockOrganizationService.VerifyAll();
        }
예제 #3
0
        public void GetOrganizationId()
        {
            WhoAmIResponse response = new WhoAmIResponse();

            systemUnderTest = new EntityRepositorySingle(MockOrganizationService.Object, MockRetryExecutor.Object, MockEntityMetadataCache.Object);

            MockOrganizationService.Setup(a => a.Execute(It.IsAny <OrganizationRequest>())).Returns(response);

            FluentActions.Invoking(() => systemUnderTest.GetOrganizationId())
            .Should()
            .NotThrow();

            MockOrganizationService.VerifyAll();
        }
예제 #4
0
        public void DeleteEntity()
        {
            Guid entityId = Guid.NewGuid();

            systemUnderTest = new EntityRepositorySingle(MockOrganizationService.Object, MockRetryExecutor.Object, MockEntityMetadataCache.Object);

            MockOrganizationService.Setup(a => a.Delete(It.IsAny <string>(), It.IsAny <Guid>()));

            FluentActions.Invoking(() => systemUnderTest.DeleteEntity(entityName, entityId))
            .Should()
            .NotThrow();

            MockOrganizationService.VerifyAll();
        }
예제 #5
0
        public void CreateEntities()
        {
            testOrgService.ExecutionResponse = new CreateResponse();

            systemUnderTest = new EntityRepositorySingle(MockOrganizationService.Object, MockRetryExecutor.Object, MockEntityMetadataCache.Object);

            var response = new UpdateResponse();

            MockOrganizationService.Setup(a => a.Execute(It.IsAny <OrganizationRequest>()))
            .Returns(response);

            FluentActions.Invoking(() => systemUnderTest.CreateEntities(entities))
            .Should()
            .NotThrow();

            MockOrganizationService.VerifyAll();
        }