Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 public void DeleteTest()
 {
     var notesController = new NotesController(MockRepositoryContext.Object, mockNoteRepository.Object);
     notesController.DeleteNote(guid2);
     Assert.AreEqual(DeleteFlag.Deleted, notes[1].Deleted);
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 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);
 }