public void ShouldSave() { //Arrange var sut = BuildSUT(); petsDataMock.SetupSaveVaccination(); mapperMock.SetupMap(sut, new VaccinationModel()); //Act sut.Save(); //Assert petsDataMock.Verify(m => m.AddVacination(It.IsAny <VaccinationModel>()), Times.Once); }
public void ShouldSaveWhenIsValid() { //Arrange var sut = BuildSUT(); petsDataMock.SetupSavePet(); mapperMock.SetupMap(sut, new PetModel()); //Act sut.Name = "name"; sut.Save(); //Assert Assert.IsTrue(sut.IsValid()); petsDataMock.Verify(m => m.AddPet(It.IsAny <PetModel>()), Times.Once); }
public void ShouldSaveNewVisitOnDialogResultOk() { //Arrange petDescriptionMock.SetupGet(x => x.Id).Returns(1); var sut = BuildSUT(); int countBefore = sut.Visits.Count; var dialogResult = new DialogResult(ButtonResult.OK); var newVisit = new VisitModel(); mapperMock.SetupMap(newVisit); petsDataMock.SetupSaveVisit(newVisit); dialogServiceMock.SetupShowDialog(DialogNames.VisitDialog, dialogResult); //Act sut.AddCommand.Execute(); //Assert petsDataMock.Verify(x => x.AddVisit(newVisit), Times.Once); }