public void Can_Delete_Container_Containing_Media_Types() { IScopeProvider provider = ScopeProvider; using (IScope scope = provider.CreateScope()) { EntityContainerRepository containerRepository = CreateContainerRepository(provider); MediaTypeRepository repository = CreateRepository(provider); var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; containerRepository.Save(container); IMediaType contentType = MediaTypeBuilder.CreateSimpleMediaType("test", "Test", propertyGroupAlias: "testGroup", propertyGroupName: "testGroup"); contentType.ParentId = container.Id; repository.Save(contentType); // Act containerRepository.Delete(container); EntityContainer found = containerRepository.Get(container.Id); Assert.IsNull(found); contentType = repository.Get(contentType.Id); Assert.IsNotNull(contentType); Assert.AreEqual(-1, contentType.ParentId); } }
public void Can_Delete_Container() { IScopeProvider provider = ScopeProvider; using (IScope scope = provider.CreateScope()) { EntityContainerRepository containerRepository = CreateContainerRepository(provider); var container = new EntityContainer(Constants.ObjectTypes.MediaType) { Name = "blah" }; containerRepository.Save(container); Assert.That(container.Id, Is.GreaterThan(0)); // Act containerRepository.Delete(container); EntityContainer found = containerRepository.Get(container.Id); Assert.IsNull(found); } }