public void CreateTestData() { var relateContent = new RelationType(new Guid(Constants.ObjectTypes.Document), new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), "relateContentOnCopy") { IsBidirectional = true, Name = "Relate Content on Copy" }; var relateContentType = new RelationType(new Guid(Constants.ObjectTypes.DocumentType), new Guid("A2CB7800-F571-4787-9638-BC48539A0EFB"), "relateContentTypeOnCopy") { IsBidirectional = true, Name = "Relate ContentType on Copy" }; var provider = new PetaPocoUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var relationTypeRepository = new RelationTypeRepository(unitOfWork); var relationRepository = new RelationRepository(unitOfWork, NullCacheProvider.Current, relationTypeRepository); relationTypeRepository.AddOrUpdate(relateContent); relationTypeRepository.AddOrUpdate(relateContentType); unitOfWork.Commit(); //Create and Save ContentType "umbTextpage" -> 1045 ContentType contentType = MockedContentTypes.CreateSimpleContentType("umbTextpage", "Textpage"); ServiceContext.ContentTypeService.Save(contentType); //Create and Save Content "Homepage" based on "umbTextpage" -> 1046 Content textpage = MockedContent.CreateSimpleContent(contentType); ServiceContext.ContentService.Save(textpage, 0); //Create and Save Content "Text Page 1" based on "umbTextpage" -> 1047 Content subpage = MockedContent.CreateSimpleContent(contentType, "Text Page 1", textpage.Id); ServiceContext.ContentService.Save(subpage, 0); //Create and Save Content "Text Page 1" based on "umbTextpage" -> 1048 Content subpage2 = MockedContent.CreateSimpleContent(contentType, "Text Page 2", textpage.Id); ServiceContext.ContentService.Save(subpage2, 0); var relation = new Relation(textpage.Id, subpage.Id, relateContent) { Comment = string.Empty }; var relation2 = new Relation(textpage.Id, subpage2.Id, relateContent) { Comment = string.Empty }; relationRepository.AddOrUpdate(relation); relationRepository.AddOrUpdate(relation2); unitOfWork.Commit(); }
public void CreateTestData() { var relateContent = new RelationType(new Guid(Constants.ObjectTypes.Document), new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), "relateContentOnCopy") { IsBidirectional = true, Name = "Relate Content on Copy" }; var relateContentType = new RelationType(new Guid(Constants.ObjectTypes.DocumentType), new Guid("A2CB7800-F571-4787-9638-BC48539A0EFB"), "relateContentTypeOnCopy") { IsBidirectional = true, Name = "Relate ContentType on Copy" }; var provider = new PetaPocoUnitOfWorkProvider(Logger); var unitOfWork = provider.GetUnitOfWork(); var repository = new RelationTypeRepository(unitOfWork, CacheHelper.CreateDisabledCacheHelper(), Mock.Of <ILogger>(), SqlSyntax); repository.AddOrUpdate(relateContent); //Id 2 repository.AddOrUpdate(relateContentType); //Id 3 unitOfWork.Commit(); }
public void CreateTestData() { var relateContent = new RelationType(new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), "relateContentOnCopy") { IsBidirectional = true, Name = "Relate Content on Copy" }; var relateContentType = new RelationType(new Guid("A2CB7800-F571-4787-9638-BC48539A0EFB"), new Guid("A2CB7800-F571-4787-9638-BC48539A0EFB"), "relateContentTypeOnCopy") { IsBidirectional = true, Name = "Relate ContentType on Copy" }; var provider = new PetaPocoUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new RelationTypeRepository(unitOfWork); repository.AddOrUpdate(relateContent); //Id 2 repository.AddOrUpdate(relateContentType); //Id 3 unitOfWork.Commit(); }
public void Can_Perform_Add_On_RelationTypeRepository() { // Arrange var provider = new PetaPocoUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new RelationTypeRepository(unitOfWork); // Act var relateMemberToContent = new RelationType(new Guid("39eb0f98-b348-42a1-8662-e7eb18487560"), new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), "relateMemberToContent") {IsBidirectional = true, Name = "Relate Member to Content"}; repository.AddOrUpdate(relateMemberToContent); unitOfWork.Commit(); // Assert Assert.That(relateMemberToContent.HasIdentity, Is.True); Assert.That(repository.Exists(relateMemberToContent.Id), Is.True); }
public void Can_Perform_Add_On_RelationTypeRepository() { // Arrange var provider = new PetaPocoUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new RelationTypeRepository(unitOfWork); // Act var relateMemberToContent = new RelationType(new Guid("39eb0f98-b348-42a1-8662-e7eb18487560"), new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), "relateMemberToContent") { IsBidirectional = true, Name = "Relate Member to Content" }; repository.AddOrUpdate(relateMemberToContent); unitOfWork.Commit(); // Assert Assert.That(relateMemberToContent.HasIdentity, Is.True); Assert.That(repository.Exists(relateMemberToContent.Id), Is.True); }
public void Can_Perform_Update_On_RelationTypeRepository() { // Arrange var provider = new PetaPocoUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new RelationTypeRepository(unitOfWork); // Act var relationType = repository.Get(3); relationType.Alias = relationType.Alias + "Updated"; relationType.Name = relationType.Name + " Updated"; repository.AddOrUpdate(relationType); unitOfWork.Commit(); var relationTypeUpdated = repository.Get(3); // Assert Assert.That(relationTypeUpdated, Is.Not.Null); Assert.That(relationTypeUpdated.HasIdentity, Is.True); Assert.That(relationTypeUpdated.Alias, Is.EqualTo(relationType.Alias)); Assert.That(relationTypeUpdated.Name, Is.EqualTo(relationType.Name)); }
public void Can_Perform_Add_On_RelationTypeRepository() { // Arrange var provider = new PetaPocoUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new RelationTypeRepository(unitOfWork); // Act var relateMemberToContent = new RelationType(new Guid(Constants.ObjectTypes.Member), new Guid(Constants.ObjectTypes.Document), "relateMemberToContent") { IsBidirectional = true, Name = "Relate Member to Content" }; repository.AddOrUpdate(relateMemberToContent); unitOfWork.Commit(); // Assert Assert.That(relateMemberToContent.HasIdentity, Is.True); Assert.That(repository.Exists(relateMemberToContent.Id), Is.True); }
public void Can_Perform_Update_On_RelationTypeRepository() { // Arrange var provider = new PetaPocoUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new RelationTypeRepository(unitOfWork); // Act var relationType = repository.Get(3); relationType.Alias = relationType.Alias + "Updated"; relationType.Name = relationType.Name + " Updated"; repository.AddOrUpdate(relationType); unitOfWork.Commit(); var relationTypeUpdated = repository.Get(3); // Assert Assert.That(relationTypeUpdated, Is.Not.Null); Assert.That(relationTypeUpdated.HasIdentity, Is.True); Assert.That(relationTypeUpdated.Alias, Is.EqualTo(relationType.Alias)); Assert.That(relationTypeUpdated.Name, Is.EqualTo(relationType.Name)); }
public void CreateTestData() { var relateContent = new RelationType(new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), "relateContentOnCopy"){IsBidirectional = true, Name = "Relate Content on Copy"}; var relateContentType = new RelationType(new Guid("A2CB7800-F571-4787-9638-BC48539A0EFB"), new Guid("A2CB7800-F571-4787-9638-BC48539A0EFB"), "relateContentTypeOnCopy") { IsBidirectional = true, Name = "Relate ContentType on Copy" }; var provider = new PetaPocoUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var repository = new RelationTypeRepository(unitOfWork); repository.AddOrUpdate(relateContent);//Id 2 repository.AddOrUpdate(relateContentType);//Id 3 unitOfWork.Commit(); }
public void CreateTestData() { var relateContent = new RelationType(new Guid(Constants.ObjectTypes.Document), new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972"), "relateContentOnCopy") { IsBidirectional = true, Name = "Relate Content on Copy" }; var relateContentType = new RelationType(new Guid(Constants.ObjectTypes.DocumentType), new Guid("A2CB7800-F571-4787-9638-BC48539A0EFB"), "relateContentTypeOnCopy") { IsBidirectional = true, Name = "Relate ContentType on Copy" }; var provider = new PetaPocoUnitOfWorkProvider(); var unitOfWork = provider.GetUnitOfWork(); var relationTypeRepository = new RelationTypeRepository(unitOfWork); var relationRepository = new RelationRepository(unitOfWork, NullCacheProvider.Current, relationTypeRepository); relationTypeRepository.AddOrUpdate(relateContent); relationTypeRepository.AddOrUpdate(relateContentType); unitOfWork.Commit(); //Create and Save ContentType "umbTextpage" -> 1045 ContentType contentType = MockedContentTypes.CreateSimpleContentType("umbTextpage", "Textpage"); ServiceContext.ContentTypeService.Save(contentType); //Create and Save Content "Homepage" based on "umbTextpage" -> 1046 Content textpage = MockedContent.CreateSimpleContent(contentType); ServiceContext.ContentService.Save(textpage, 0); //Create and Save Content "Text Page 1" based on "umbTextpage" -> 1047 Content subpage = MockedContent.CreateSimpleContent(contentType, "Text Page 1", textpage.Id); ServiceContext.ContentService.Save(subpage, 0); //Create and Save Content "Text Page 1" based on "umbTextpage" -> 1048 Content subpage2 = MockedContent.CreateSimpleContent(contentType, "Text Page 2", textpage.Id); ServiceContext.ContentService.Save(subpage2, 0); var relation = new Relation(textpage.Id, subpage.Id, relateContent) { Comment = string.Empty }; var relation2 = new Relation(textpage.Id, subpage2.Id, relateContent) { Comment = string.Empty }; relationRepository.AddOrUpdate(relation); relationRepository.AddOrUpdate(relation2); unitOfWork.Commit(); }