Ejemplo n.º 1
0
        public void ShouldRemoveFromNotesWhenNoteHasNotIdOnCancel()
        {
            //Arrange
            var sut        = BuildSUT();
            var mockedNote = new NoteViewModelMock();

            sut.Notes.Add(mockedNote.Object);
            var countBefore = sut.Notes.Count;

            //Act
            sut.CancelCommand.Execute(mockedNote.Object.Id);

            //Assert
            Assert.AreNotEqual(countBefore, sut.Notes.Count);
        }
Ejemplo n.º 2
0
        private List <NoteViewModelMock> GetNotesMocks()
        {
            var viewmodelMock = new NoteViewModelMock();

            viewmodelMock.SetupGet(x => x.Id).Returns(1);

            var viewModelMock2 = new NoteViewModelMock();

            viewModelMock2.SetupGet(x => x.Id).Returns(2);

            return(new List <NoteViewModelMock>()
            {
                viewmodelMock,
                viewModelMock2
            });
        }
Ejemplo n.º 3
0
        public void ShouldSaveNewVaccination()
        {
            //Arrange
            var sut = BuildSUT();

            var noteViewModelMock = new NoteViewModelMock();

            noteViewModelMock.SetupSave();

            sut.Notes.Add(noteViewModelMock.Object);

            //Act
            sut.SaveCommand.Execute(noteViewModelMock.Object.Id);

            //Assert
            noteViewModelMock.Verify(x => x.Save(), Times.Once);
        }
Ejemplo n.º 4
0
        public void ShouldInvokeCancelWhenNoteHasId()
        {
            //Arrange
            var sut         = BuildSUT();
            var mockedVNote = new NoteViewModelMock();

            mockedVNote.SetupGet(x => x.Id).Returns(1);
            mockedVNote.SetupCancel();

            sut.Notes.Add(mockedVNote.Object);

            //Act
            sut.CancelCommand.Execute(mockedVNote.Object.Id);

            //Assert
            mockedVNote.Verify(x => x.Cancel(), Times.Once);
        }