public PathsControllerTest() { ServiceProvider serviceProvider = CreateServiceProvider(); IServiceProvider service = serviceProvider.GetService <IServiceProvider>(); _context = service.GetRequiredService <DeliveryServiceContext>(); _pathRepository = new PathRepository(_context) as IPathRepository; _pointRepository = new PointRepository(_context) as IPointRepository; _routeRepository = new RouteRepository(_context) as IRouteRepository; DatabaseInitializer.Seed(service); }
public ListType(IListRepository listRepository, IPointRepository pointRepository) { Field(x => x.IdLab).Description("IdLab"); Field(x => x.IdProject).Description("IdProject"); Field(x => x.IdList).Description("IdList"); Field(x => x.Name).Description("Name"); Field(x => x.Timestamp, nullable: true).Description("Timestamp"); Field <ListGraphType <PointType> >( "points", resolve: x => pointRepository.GetPointsForList(x.Source.IdLab, x.Source.IdProject, x.Source.IdList) ); }
public StorePromotionCouponController(ICardRepository cardRepo, IGroupCardService groupData, IStoreCouponsRepository storecouponRepo, IStorePromotionRepository storeproRepo, IPointRepository pointRepo, IStorePromotionScopeRepository storeproscopeRepo, ICouponLogRepository couponlogRepo) { _cardRepo = cardRepo; _groupData = groupData; _storecouponRepo = storecouponRepo; _storeproRepo = storeproRepo; _pointRepo = pointRepo; _storeproscopeRepo = storeproscopeRepo; _couponlogRepo = couponlogRepo; }
public void Points_Delete_StatusCode_400(int status) { IPointRepository pointRepository = null; PointsController controller = new PointsController(pointRepository); Point point = new Point() { Name = "K", PointId = 10 }; IActionResult result = controller.DeletePoint(point.PointId); BadRequestObjectResult actionResult = result.Should().BeOfType <BadRequestObjectResult>().Subject; actionResult.StatusCode.Should().Be(status, $"StatusCode should be {status}"); }
/// <summary>Constructor to the calculator of all paths between an origin and a destination point.</summary> /// <param name="pointRepository">Point repository.</param> /// <param name="stepRepository">Step repository.</param> /// <param name="routeBase">Route base holding the origin and destination points.</param> public AllPathsCalculator(IPointRepository pointRepository, IStepRepository stepRepository, RouteBase routeBase) { _pointRepository = pointRepository; _stepRepository = stepRepository; _pointStepsList = new List <PointSteps>(); _isVisited = new List <Point>(); Route = new Route { Id = routeBase.Id, Origin = routeBase.Origin, OriginId = routeBase.Origin.Id, Destination = routeBase.Destination, DestinationId = routeBase.Destination.Id, StepsCollectionList = new List <StepsCollection>() }; }
public PostApplicationService( IUnitOfWork unitOfWork, IPostRepository postRepository, IPointRepository pointRepository, IUserRepository userRepository, ILikeRepository likesRepository, ITagRepository tagRepository, IPostTagRepository postTagRepository) { _unitOfWork = unitOfWork; _postRepository = postRepository; _pointRepository = pointRepository; _userRepository = userRepository; _likesRepository = likesRepository; _tagRepository = tagRepository; _postTagRepository = postTagRepository; }
public void Paths_Add_StatusCode_400(int status) { IPathRepository pathRepository = null; IPointRepository pointRepository = null; PathsController controller = new PathsController(pathRepository, pointRepository); Path path = new Path() { DestinyId = 1, OriginId = 2 }; IActionResult result = controller.PostPath(path); int?statusCode = ((ObjectResult)(result.Should().Subject)).StatusCode; statusCode.Should().Be(status, $"StatusCode should be {status}"); }
public ProjectType(IListRepository listRepository, ISeriesRepository seriesRepository, IPointRepository pointRepository) { Field(x => x.IdLab).Description("IdLab"); Field(x => x.IdProject).Description("IdProject"); Field(x => x.Name).Description("Name"); Field(x => x.Customer).Description("Customer"); Field(x => x.Timestamp, nullable: true).Description("Timestamp"); Field <ListGraphType <ListType> >( "lists", resolve: x => listRepository.GetListsForProject(x.Source.IdLab, x.Source.IdProject) ); Field <ListGraphType <SeriesType> >( "series", resolve: x => seriesRepository.GetSeriesForLab(x.Source.IdLab) ); Field <ListGraphType <PointType> >( "points", resolve: x => pointRepository.GetPointsForProject(x.Source.IdLab, x.Source.IdProject) ); }
public async Task GetPointsTest() { var token = new System.Threading.CancellationToken(); IPointRepository repository = Provider.GetService <IPointRepository>(); await repository.Add(new Infrastructure.Persistence.DTO.Point() { Name = "A" }, token); await repository.Add(new Infrastructure.Persistence.DTO.Point() { Name = "B" }, token); await repository.Add(new Infrastructure.Persistence.DTO.Point() { Name = "C" }, token); var points = await repository.GetAll(token); Assert.IsNotNull(points); Assert.AreEqual(3, points.Count()); }
public RepositoryFactory( DataContext repositoryContext, IUserRepository userRepository, IInternRepository internRepository, IPointRepository pointRepository, IDepartmentRepository departmentRepository, ITrainingRepository trainingRepository, IEventTypeRepository eventTypeRepository, IQuestionRepository questionRepository, IEventRepository eventRepository, IOrganizationRepository organizationRepository ) { _repositoryContext = repositoryContext; _userRepository = userRepository; _internRepository = internRepository; _pointRepository = pointRepository; _departmentRepository = departmentRepository; _organizationRepository = organizationRepository; _trainingRepository = trainingRepository; _eventRepository = eventRepository; _eventTypeRepository = eventTypeRepository; _questionRepository = questionRepository; }
public GHeatRepository(ISettingsRepository settingsRepository, IPointRepository pointRepository) { if (settingsRepository == null) { throw new ArgumentNullException("Settings"); } _settingsRepository = settingsRepository; if (pointRepository == null) { throw new ArgumentNullException("Point"); } _pointRepository = pointRepository; string directory = _settingsRepository.BaseDirectory; if (string.IsNullOrEmpty(directory)) { throw new ArgumentNullException("Base Directroy"); } _dotsList = new Dictionary <string, Bitmap>(); _colourSchemeList = new Dictionary <string, Bitmap>(); foreach (string file in System.IO.Directory.GetFiles(directory + DOTS_FOLDER, "*." + ImageFormat.Png.ToString().ToLower())) { _dotsList.Add(Path.GetFileName(file), new Bitmap(file)); } foreach (string file in System.IO.Directory.GetFiles(directory + COLOR_SCHMES_FOLDER, "*." + ImageFormat.Png.ToString().ToLower())) { _colourSchemeList.Add(Path.GetFileName(file), new Bitmap(file)); } }
public PointService(IPointRepository pointRepository) { _pointRepository = pointRepository; }
public ReportAirQualityController(IReportAirQualityInDayRepository reportAirQuality, IPointRepository pointRepository) { this.reportAirQuality = reportAirQuality; _pointRepository = pointRepository; }
public PointUpdateTransaction(IPointRepository pointRepository) : base(pointRepository) { }
public PointService(IPointRepository pointRepo) : base(pointRepo) { _pointRepo = pointRepo; }
public ComputeRoutePaths(ICacheManager cacheManager, IStepRepository stepRepository, IPointRepository pointRepository) { _cacheManager = cacheManager; _stepRepository = stepRepository; _pointRepository = pointRepository; }
public BaseTransaction(IPointRepository pointRepository) { PointRepository = pointRepository; }
public PointModelBinder(IPointRepository service) { _pointRepository = service; }
public PathsController(IPathRepository pathRepository, IPointRepository pointRepository) { _pathRepository = pathRepository; _pointRepository = pointRepository; }
public PointService(IPointRepository pointRepository, IUnitOfWork unitOfWork) { _pointRepository = pointRepository; _unitOfwork = unitOfWork; }
public PointListTransaction(IPointRepository pointRepository) : base(pointRepository) { }
public StatisticService(IUnitOfWork unitOfWork, IPointRepository pointRepository, IPostRepository postRepository) { this.unitOfWork = unitOfWork; this.pointRepository = pointRepository; this.postRepository = postRepository; }
public DeliveryService(IPointRepository points) { _points = points; }
public RoutesController() { userRepository = new UserRepository(); routeRepository = new RouteRepository(); pointRepository = new PointRepository(); }
public AppMutation( ILabRepository labRepository, IProjectRepository projectRepository, IListRepository listRepository, ISeriesRepository seriesRepository, IPointRepository pointRepository) { #region LabMutations FieldAsync <LabType>( "createLab", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <LabInputType> > { Name = "lab" }), resolve: async context => await labRepository.Create(context.GetArgument <LabDto>("lab")) ); FieldAsync <LabType>( "updateLab", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <LabInputType> > { Name = "lab" }, new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idLab" } ), resolve: async context => { var lab = context.GetArgument <LabDto>("lab"); var labId = context.GetArgument <int>("idLab"); if (labRepository.GetById(labId) == null) { context.Errors.Add(new ExecutionError("Entity does not exist!")); return(null); } return(await labRepository.Update(lab, labId)); }); FieldAsync <StringGraphType>( "deleteLab", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idLab" } ), resolve: async context => { var labId = context.GetArgument <int>("idLab"); if (labRepository.GetById(labId) == null) { context.Errors.Add(new ExecutionError("Entity does not exist!")); return(null); } if (await labRepository.Delete(labId)) { return("Entity deleted successfully"); } else { return("Removing failed!"); } }); #endregion #region ProjectMutations FieldAsync <ProjectType>( "createProject", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <ProjectInputType> > { Name = "project" }), resolve: async context => await projectRepository.Create(context.GetArgument <ProjectDto>("project")) ); FieldAsync <ProjectType>( "updateProject", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <ProjectInputType> > { Name = "project" }, new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idLab" }, new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idProject" } ), resolve: async context => { var project = context.GetArgument <ProjectDto>("project"); var labId = context.GetArgument <int>("idLab"); var projectId = context.GetArgument <int>("idProject"); if (projectRepository.GetById(labId, projectId) == null) { context.Errors.Add(new ExecutionError("Entity does not exist!")); return(null); } return(await projectRepository.Update(project, labId, projectId)); }); FieldAsync <StringGraphType>( "deleteProject", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idLab" }, new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idProject" } ), resolve: async context => { var labId = context.GetArgument <int>("idLab"); var projectId = context.GetArgument <int>("idProject"); if (projectRepository.GetById(labId, projectId) == null) { context.Errors.Add(new ExecutionError("Entity does not exist!")); return(null); } if (await projectRepository.Delete(labId, projectId)) { return("Entity deleted successfully"); } else { return("Removing failed!"); } }); #endregion }
public PointsController(IOnWaterProvider onWaterApi, IPointRepository repository, ILogger <PointsController> logger) { this.onWaterApi = onWaterApi; this.repository = repository; this.logger = logger; }
public BaseTransaction(IPointRepository pointRepository, IRouteRepository routeRepository) { PointRepository = pointRepository; RouteRepository = routeRepository; }
public PointsListController(IPointRepository pointRepository) { _pointRepository = pointRepository; }
public ManagementDeviceController(IIBMClientHelper iBMClientHelper, IPointRepository pointRepository) { _IBMClientHelper = iBMClientHelper; _pointRepository = pointRepository; }
public PointController(IPointRepository pointRepository, IUserService userService) { _pointRepository = pointRepository; _userService = userService; }
public PointDataService(IPointRepository pointRepository) { this._pointRepository = pointRepository; }
public AppQuery( ILabRepository labRepository, IProjectRepository projectRepository, IListRepository listRepository, ISeriesRepository seriesRepository, IPointRepository pointRepository) { #region GetAll Field <ListGraphType <LabType> >( "labs", resolve: context => labRepository.GetAll() ); Field <ListGraphType <ProjectType> >( "projects", resolve: context => projectRepository.GetAll() ); Field <ListGraphType <ListType> >( "lists", resolve: context => listRepository.GetAll() ); Field <ListGraphType <SeriesType> >( "series", resolve: context => seriesRepository.GetAll() ); Field <ListGraphType <PointType> >( "points", resolve: x => pointRepository.GetAll() ); #endregion #region GetById Field <LabType>( "lab", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idLab" }), resolve: context => { return(labRepository.GetById(context.GetArgument <int>("idLab"))); } ); Field <ProjectType>( "project", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idLab" }, new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idProject" } ), resolve: context => { return(projectRepository.GetById( context.GetArgument <int>("idLab"), context.GetArgument <int>("idProject"))); } ); Field <SeriesType>( "serie", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idLab" }, new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idProject" }, new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idSeries" } ), resolve: context => { return(seriesRepository.GetById( context.GetArgument <int>("idLab"), context.GetArgument <int>("idProject"), context.GetArgument <int>("idSeries"))); } ); Field <ListType>( "list", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idLab" }, new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idProject" }, new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idList" } ), resolve: context => { return(listRepository.GetById( context.GetArgument <int>("idLab"), context.GetArgument <int>("idProject"), context.GetArgument <int>("idList"))); } ); Field <PointType>( "point", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idLab" }, new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idProject" }, new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idSeries" }, new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "idPoint" } ), resolve: context => { return(pointRepository.GetById( context.GetArgument <int>("idLab"), context.GetArgument <int>("idProject"), context.GetArgument <int>("idSeries"), context.GetArgument <int>("idPoint"))); } ); #endregion }
public PointHistoryService(IPointRepository pointRepository, PointContext pointContext) { this.pointRepository = pointRepository ?? throw new ArgumentNullException("pointHistoryService"); this.pointContext = pointContext ?? throw new ArgumentNullException("pointHistoryService"); }
public MappingManagerV2() { //注意 只能 查询不能有修改操作 _userAccountRepository = ServiceLocator.Current.Resolve<IUserAccountRepository>(); _vUserRoleRepository = ServiceLocator.Current.Resolve<IVUserRoleRepository>(); _promotionBrandRelationRepository = ServiceLocator.Current.Resolve<IPromotionBrandRelationRepository>(); _likeRepository = ServiceLocator.Current.Resolve<ILikeRepository>(); _couponRepository = ServiceLocator.Current.Resolve<ICouponRepository>(); _favoriteRepository = ServiceLocator.Current.Resolve<IFavoriteRepository>(); _pointRepository = ServiceLocator.Current.Resolve<IPointRepository>(); }