public void Cannot_Update_For_NonExists_NoteRender() { // Arrange var render = new NoteRender { Name = "GasLog", Namespace = "Note.GasLog", IsDefault = true, Description = "testing note" }; RenderRepository.Add(render); var render2 = new NoteRender { Name = "GasLog2", Namespace = "Note.GasLog", IsDefault = false, Description = "testing note" }; // Act var result = RenderRepository.Update(render2); // Assert Assert.Null(result); Assert.False(RenderRepository.ProcessMessage.Success); Assert.Single(RenderRepository.ProcessMessage.MessageList); }
public void Cannot_Update_Note_Render_With_DuplicatedName() { // Arrange var render = new NoteRender { Name = "GasLog", IsDefault = true, Description = "testing note" }; RenderRepository.Add(render); var render2 = new NoteRender { Name = "GasLog2", IsDefault = false, Description = "testing note2" }; RenderRepository.Add(render2); render.Name = render2.Name; // Act var result = RenderRepository.Update(render); // Assert Assert.Null(result); Assert.False(RenderRepository.ProcessMessage.Success); Assert.Single(RenderRepository.ProcessMessage.MessageList); }
public void Can_Update_NoteRender() { // Arrange - update name var render = new NoteRender { Name = "GasLog", Namespace = "Note.GasLog", Description = "testing note" }; RenderRepository.Add(render); render.Name = "GasLog2"; // Act var result = RenderRepository.Update(render); // Assert Assert.NotNull(result); Assert.Equal("GasLog2", result.Name); // Arrange - update description render.Description = "new testing note"; // Act result = RenderRepository.Update(render); // Assert Assert.NotNull(result); Assert.Equal("new testing note", result.Description); }