public void DeleteEntity() { Guid entityId = Guid.NewGuid(); systemUnderTest = new EntityRepository(MockOrganizationService.Object, MockRetryExecutor.Object, MockEntityMetadataCache.Object, cachingMode); MockOrganizationService.Setup(a => a.Delete(It.IsAny <string>(), It.IsAny <Guid>())); FluentActions.Invoking(() => systemUnderTest.DeleteEntity(entityName, entityId)) .Should() .NotThrow(); MockOrganizationService.VerifyAll(); }
public void GetAllEntitesMetadata() { systemUnderTest = new EntityRepository(MockOrganizationService.Object, MockRetryExecutor.Object, MockEntityMetadataCache.Object); RetrieveAllEntitiesResponse response = new RetrieveAllEntitiesResponse(); MockOrganizationService.Setup(a => a.Execute(It.IsAny <OrganizationRequest>())) .Returns(response); FluentActions.Invoking(() => systemUnderTest.GetAllEntitesMetadata()) .Should() .NotThrow(); MockOrganizationService.VerifyAll(); }
public async Task LogOn_POST_RedirectUrl() { // arrange MockOrganizationService.Setup_LogOn_Returns_LogOnResponse_Success(); var model = GetOrganizationOneUserOneLogOnModel(); model.RedirectUrl = StringOne; // act var result = await SystemUnderTest.LogOn(model); // assert AssertView <RedirectResult>(result); ((RedirectResult)result).Url.ShouldBe(StringOne); MockOrganizationService.Verify(); }
public void GetLookUpEntityNameNoEntityFound() { string entityName = "contactluenNoEntityFound"; string attributeName = "contactluenid"; var manyToManyRelationships = new List <OneToManyRelationshipMetadata>(); RetrieveEntityResponse response = InjectMetaDataToResponse(new RetrieveEntityResponse(), null, manyToManyRelationships); MockOrganizationService.Setup(a => a.Execute(It.IsAny <OrganizationRequest>())).Returns(response); FluentActions.Invoking(() => systemUnderTest.GetLookUpEntityName(entityName, attributeName)) .Should() .NotThrow(); MockOrganizationService.VerifyAll(); }
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(); }
public void GetIdAliasKey() { string entityName = "contactIdAliasKey"; string attributeName = "contactIdAliasKeyid"; var attributeMetaDataItem = new AttributeMetadata { LogicalName = attributeName }; SetFieldValue(attributeMetaDataItem, "_attributeType", AttributeTypeCode.Uniqueidentifier); var attributes = new List <AttributeMetadata> { attributeMetaDataItem }; var oneToManyRelationshipMetadata = new OneToManyRelationshipMetadata { ReferencingAttribute = attributeName }; var oneToManyRelationships = new List <OneToManyRelationshipMetadata> { oneToManyRelationshipMetadata }; var entityMetaData = InitializeEntityMetadata(attributes, oneToManyRelationships); SetFieldValue(entityMetaData, "_primaryIdAttribute", attributeName); var response = InjectMetaDataToResponse(new RetrieveEntityResponse(), entityMetaData); MockOrganizationService.Setup(a => a.Execute(It.IsAny <OrganizationRequest>())).Returns(response); string actual = null; FluentActions.Invoking(() => actual = systemUnderTest.GetIdAliasKey(entityName)) .Should() .NotThrow(); MockOrganizationService.VerifyAll(); actual.Should().NotBeNullOrEmpty(); }
public void Setup() { InitializeProperties(); originalEntity = new EntityWrapper(new Entity() { LogicalName = "testentity", Id = Guid.NewGuid() }); newEntity = new EntityWrapper(new Entity() { LogicalName = "testentity", Id = Guid.NewGuid() }); updatedEntity = new EntityWrapper(new Entity() { LogicalName = "testentity", Id = originalEntity.Id }); unchangedEntity = new EntityWrapper(new Entity() { LogicalName = "testentity", Id = originalEntity.Id }); originalEntity.OriginalEntity.Attributes["testattribute"] = "1"; newEntity.OriginalEntity.Attributes["testattribute"] = "2"; updatedEntity.OriginalEntity.Attributes["testattribute"] = "3"; unchangedEntity.OriginalEntity.Attributes["testattribute"] = originalEntity.OriginalEntity.Attributes["testattribute"]; var entityCollection = new EntityCollection(); entityCollection.Entities.Add(originalEntity.OriginalEntity); MockEntityRepo.Setup(a => a.GetCurrentOrgService).Returns(MockOrganizationService.Object); MockOrganizationService.Setup(a => a.RetrieveMultiple(It.IsAny <QueryBase>())) .Returns(entityCollection); systemUnderTest = new SkipExistingRecordProcessor(MockLogger.Object, MockEntityRepo.Object); }
public void GetManyToManyEntityDetails() { string intersectEntityName = "accountcontactmtmed"; var relationship = new ManyToManyRelationshipMetadata { IntersectEntityName = intersectEntityName }; var manyToManyRelationships = new List <ManyToManyRelationshipMetadata> { relationship }; RetrieveEntityResponse response = InjectMetaDataToResponse(new RetrieveEntityResponse(), null, null, manyToManyRelationships, true); MockOrganizationService.Setup(a => a.Execute(It.IsAny <OrganizationRequest>())).Returns(response); FluentActions.Invoking(() => systemUnderTest.GetManyToManyEntityDetails(intersectEntityName)) .Should() .NotThrow(); MockOrganizationService.VerifyAll(); }
private void SetupCurrentUser() { MockOrganizationService.Setup(x => x.GetCurrentUser(It.IsAny <CurrentUserRequest>())).Returns(GetOrganizationOneCurrentUserOne()); }