public static IPacientBusiness GetPacientBusiness() { IDataFactory dataFactory = new DataFactory(); IRepositoryFactory repositoryFactory = new RepositoryFactory(dataFactory); IPacientBusiness business = new PacientBusiness(repositoryFactory); return(business); }
public void Should_save_pacient() { var pacient = new Pacient(); var repositoryMock = new Mock <IRepository <Pacient> >(); var repositoryFactoryMock = new Mock <IRepositoryFactory>(); repositoryFactoryMock .Setup(s => s.Get <Pacient>()) .Returns(repositoryMock.Object); var business = new PacientBusiness(repositoryFactoryMock.Object); business.Save(pacient); repositoryMock.Verify(v => v.Save(pacient), Times.Once(), "Pacient not saved."); }