public void Cannot_Delete_NoteRender_With_CatalogAssociated() { // Arrange var render = new NoteRender { Name = "DefaultRender", Namespace = "NameSpace", IsDefault = true, Description = "Description" }; var savedRender = RenderRepository.Add(render); var catalog = new NoteCatalog { Name = "GasLog", Render = savedRender, Schema = "Scheme", IsDefault = true, Description = "testing Catalog" }; CatalogRepository.Add(catalog); // Act var result = RenderRepository.Delete(render); // Assert Assert.False(result, "Error: deleted render with catalog attached to it"); Assert.False(RenderRepository.ProcessMessage.Success); Assert.Single(RenderRepository.ProcessMessage.MessageList); }
public void Cannot_Delete_NonExists_NoteRender_From_DataSource() { // Arrange var render = new NoteRender { Name = "GasLog", Namespace = "Note.GasLog", Description = "testing note" }; RenderRepository.Add(render); var render2 = new NoteRender { Name = "GasLog2", Namespace = "Note.GasLog2", Description = "testing note" }; // Act var result = RenderRepository.Delete(render2); // Assert Assert.False(result); Assert.False(RenderRepository.ProcessMessage.Success); Assert.Single(RenderRepository.ProcessMessage.MessageList); }
public void Dispose() { if (_dbContext is DbContext context) { context.Reset(); } var systems = LookupRepo.GetEntities <Subsystem>().ToList(); foreach (var sys in systems) { SubsystemRepository.Delete(sys); } var notes = LookupRepo.GetEntities <HmmNote>().ToList(); foreach (var note in notes) { NoteRepository.Delete(note); } var catalogs = LookupRepo.GetEntities <NoteCatalog>().ToList(); foreach (var catalog in catalogs) { CatalogRepository.Delete(catalog); } var renders = LookupRepo.GetEntities <NoteRender>().ToList(); foreach (var render in renders) { RenderRepository.Delete(render); } var authors = LookupRepo.GetEntities <Author>().ToList(); foreach (var author in authors) { AuthorRepository.Delete(author); } if (_dbContext is DbContext newContext) { newContext.Reset(); } GC.SuppressFinalize(this); }
public void Can_Delete_NoteRender_From_DataSource() { // Arrange var render = new NoteRender { Name = "GasLog", Namespace = "Note.GasLog", Description = "testing note" }; RenderRepository.Add(render); // Act var result = RenderRepository.Delete(render); // Assert Assert.True(result); Assert.True(RenderRepository.ProcessMessage.Success); }