public void CannotChangeAuthorForExistsNote() { // Arrange var note = new HmmNote { Author = _user, Description = "testing note", Subject = "testing note is here", Content = "<root><time>2017-08-01</time></root>", Catalog = new NoteCatalog() }; CurrentTime = new DateTime(2021, 4, 4, 8, 15, 0); _manager.Create(note); Assert.True(_manager.ProcessResult.Success); var savedRec = NoteRepository.GetEntities().FirstOrDefault(); Assert.NotNull(savedRec); Assert.Equal("jfang", savedRec.Author.AccountName); // change the note render var newUser = LookupRepo.GetEntities <Author>().FirstOrDefault(u => u.AccountName != "jfang"); Assert.NotNull(newUser); note.Author = newUser; // Act var processResult = new ProcessingResult(); var result = _validator.IsValidEntity(note, processResult); // Assert Assert.False(result); }
public void Can_Add_Note_To_DataSource() { // Arrange var note = new HmmNote { Author = _user, Subject = "Testing note", Content = "Test content" }; // Act CurrentTime = new DateTime(2021, 4, 4, 8, 15, 0); var newNote = _manager.Create(note); // Assert Assert.True(_manager.ProcessResult.Success); Assert.NotNull(newNote); Assert.True(newNote.Id >= 1, "newNote.Id >=1"); Assert.Equal("Testing note", newNote.Subject); Assert.Equal(newNote.CreateDate, newNote.LastModifiedDate); Assert.Equal(newNote.CreateDate, CurrentTime); Assert.False(note.IsDeleted); }