public void UpdateNoteShouldReturnNoteUser()
        {
            //var note = this.GetNote();
            var noteUser = new NoteUser {
                UserId = "Mukesh", Notes = this.GetNotes()
            };
            int    noteId = 101;
            string userId = "Mukesh";

            Note note = new Note();

            note.Id           = 101;
            note.Title        = "IPL 2018";
            note.Content      = "Mumbai Indians vs RCB match scheduled  for 4 PM is cancelled";
            note.Category     = this.GetCategory();
            note.Reminders    = this.GetReminder();
            note.CreatedBy    = "Mukesh";
            note.CreationDate = new DateTime();

            var mockRepo = new Mock <INoteRepository>();

            mockRepo.Setup(repo => repo.UpdateNote(noteId, userId, note)).Returns(noteUser);
            var service = new API.Service.NoteService(mockRepo.Object);

            var actual = service.UpdateNote(noteId, userId, note);

            Assert.NotNull(actual);
            Assert.IsAssignableFrom <NoteUser>(actual);
        }
        public void GetNoteByNoteIdShouldReturnNote()
        {
            int    noteId   = 101;
            string userId   = "Mukesh";
            var    mockRepo = new Mock <INoteRepository>();

            mockRepo.Setup(repo => repo.FindByUserId(userId)).Returns(this.GetNotes());
            var service = new API.Service.NoteService(mockRepo.Object);

            var actual = service.GetNote(userId, noteId);
        }
        public void GetAllNotesShouldReturnAList()
        {
            string userId   = "Mukesh";
            var    mockRepo = new Mock <INoteRepository>();

            mockRepo.Setup(repo => repo.FindByUserId(userId)).Returns(this.GetNotes());
            var service = new API.Service.NoteService(mockRepo.Object);

            var actual = service.GetAllNotes(userId);

            Assert.NotEmpty(actual);
            Assert.IsAssignableFrom <List <Note> >(actual);
        }
        public void DeleteNoteShouldReturnTrue()
        {
            int    noteId   = 101;
            string userId   = "Mukesh";
            var    mockRepo = new Mock <INoteRepository>();

            mockRepo.Setup(repo => repo.DeleteNote(userId, noteId)).Returns(true);
            var service = new API.Service.NoteService(mockRepo.Object);

            var actual = service.DeleteNote(userId, noteId);

            Assert.True(actual);
        }
        public void CreateNoteShouldReturnNoteUser()
        {
            var note = new NoteUser {
                UserId = "Mukesh", Notes = this.GetNotes()
            };
            var mockRepo = new Mock <INoteRepository>();

            mockRepo.Setup(repo => repo.CreateNote(note)).Returns(note);
            var service = new API.Service.NoteService(mockRepo.Object);

            var actual = service.CreateNote(note);

            Assert.NotNull(actual);
            Assert.IsAssignableFrom <NoteUser>(actual);
        }
        public void AddNoteShouldReturnNoteUser()
        {
            var note     = this.GetNote();
            var noteUser = new NoteUser {
                UserId = "Mukesh", Notes = this.GetNotes()
            };
            int    noteId   = 101;
            string userId   = "Mukesh";
            var    mockRepo = new Mock <INoteRepository>();

            mockRepo.Setup(repo => repo.UpdateNote(noteId, userId, note)).Returns(noteUser);
            var service = new API.Service.NoteService(mockRepo.Object);

            var actual = service.AddNote(userId, note);

            Assert.NotNull(actual);
            Assert.IsAssignableFrom <NoteUser>(actual);
        }