public void Init() { Mock <IInstallationRepository <InstallationModel> > mockInstallationRepository = new Mock <IInstallationRepository <InstallationModel> >(); Mock <IMeasurementTypeRepository <MeasurementTypeModel> > mockMeasurementTypeRepository = new Mock <IMeasurementTypeRepository <MeasurementTypeModel> >(); List <MeasurementTypeModel> measurementtypes = new List <MeasurementTypeModel> { new MeasurementTypeModel { typeid = 0, Measurement = new List <int> { 0 }, description = "test", maxvalue = 0, minvalue = 0, unit = "Grad Celsius" } }; List <InstallationModel> installations = new List <InstallationModel> { new InstallationModel { installationid = 0, customerid = 0, description = "test", latitude = 44, longitude = 55, Measurement = new List <int> { 0 }, serialno = "serial" } }; mockInstallationRepository.Setup(mr => mr.GetByCustomerId(It.IsAny <int>())).Returns((int customerid) => installations.Where(installation => installation.customerid == customerid).ToList <InstallationModel>()); mockMeasurementTypeRepository.Setup(mr => mr.GetById(It.IsAny <int>())).Returns((int id) => measurementtypes.Where(measurementtype => measurementtype.typeid == id).Single()); this.mockmrepo = new MockMeasurementRepository(); this.mockmtrepo = mockMeasurementTypeRepository.Object; this.mockirepo = mockInstallationRepository.Object; }
public MeasurementsTypeController(IMeasurementTypeRepository measurementTypeRepository, ILoggerService logger, IMapper mapper ) { this.measurementTypeRepository = measurementTypeRepository; this.logger = logger; this.mapper = mapper; }
public void Init() { Mock<IInstallationRepository<InstallationModel>> mockInstallationRepository = new Mock<IInstallationRepository<InstallationModel>>(); Mock<IMeasurementTypeRepository<MeasurementTypeModel>> mockMeasurementTypeRepository = new Mock<IMeasurementTypeRepository<MeasurementTypeModel>>(); List<MeasurementTypeModel> measurementtypes = new List<MeasurementTypeModel> { new MeasurementTypeModel { typeid=0, Measurement = new List<int> {0}, description = "test", maxvalue = 0, minvalue =0, unit = "Grad Celsius"} }; List<InstallationModel> installations = new List<InstallationModel> { new InstallationModel { installationid= 0, customerid=0, description="test", latitude=44, longitude=55, Measurement= new List<int>{0}, serialno="serial"} }; mockInstallationRepository.Setup(mr => mr.GetByCustomerId(It.IsAny<int>())).Returns((int customerid) => installations.Where(installation => installation.customerid == customerid).ToList<InstallationModel>()); mockMeasurementTypeRepository.Setup(mr => mr.GetById(It.IsAny<int>())).Returns((int id) => measurementtypes.Where(measurementtype => measurementtype.typeid == id).Single()); this.mockmrepo = new MockMeasurementRepository(); this.mockmtrepo = mockMeasurementTypeRepository.Object; this.mockirepo = mockInstallationRepository.Object; }
public StatisticService(IInstallationRepository<InstallationModel> irepo, IMeasurementRepository<MeasurementModel> mrepo, IMeasurementTypeRepository<MeasurementTypeModel> mtrepo) { this.irepo = irepo; this.mrepo = mrepo; this.mtrepo = mtrepo; }
public MeasurementTypeService(IUnitOfWork unitOfWork, IMeasurementTypeRepository measurementTypeRepository) : base(unitOfWork, measurementTypeRepository) { _unitOfWork = unitOfWork; _measurementTypeRepository = measurementTypeRepository; }
public StatisticService(IInstallationRepository <InstallationModel> irepo, IMeasurementRepository <MeasurementModel> mrepo, IMeasurementTypeRepository <MeasurementTypeModel> mtrepo) { this.irepo = irepo; this.mrepo = mrepo; this.mtrepo = mtrepo; }