public void CreateNoteTest() { var notesController = new NotesController(MockRepositoryContext.Object, mockNoteRepository.Object); var createNoteViewModel = new CreateNoteViewModel { Content = "Test Content", Title = "Test", Weather = "Sunny" }; notesController.CreateNote(createNoteViewModel); Assert.AreEqual(3, notes.Count); Assert.IsNotNull(notes[0].User); Assert.AreEqual(CurrentLoginUser, notes[0].User); }
public void DeleteTest() { var notesController = new NotesController(MockRepositoryContext.Object, mockNoteRepository.Object); notesController.DeleteNote(guid2); Assert.AreEqual(DeleteFlag.Deleted, notes[1].Deleted); }
public void UpdateNoteTest() { var updateViewModel = new UpdateNoteViewModel { Content = "updated", ID = guid2, Title = "updated title", Weather = "Foggy" }; var notesController = new NotesController(MockRepositoryContext.Object, mockNoteRepository.Object); notesController.UpdateNote(updateViewModel); Assert.AreEqual(updateViewModel.Content, notes[1].Content); Assert.AreEqual(guid2, notes[1].ID); Assert.AreEqual(updateViewModel.Title, notes[1].Title); Assert.AreEqual(Weather.Foggy, notes[1].Weather); }
public void MarkDeleteWithInvalidUserTest() { var user = new User { ID = Guid.NewGuid(), UserName = "******", Password = "******" }; this.InjectLoginUser(user); var notesController = new NotesController(MockRepositoryContext.Object, mockNoteRepository.Object); notesController.MarkDelete(guid1); }