示例#1
0
        public async Task Get_All_Slots_Successes()
        {
            Setup();
            var slots = GenerateListOfSlots();

            var slotsContract = GenerateListOfSlotsContract();

            _applicationContextMock.Setup(x => x.Slots).ReturnsDbSet(slots);

            _testedService = new SlotService(Logger, _applicationContextMock.Object);



            var result = await _testedService.TakeAllSlots();

            var actual = result.ToList();
            var i      = 0;


            foreach (var expectedContract in slotsContract)
            {
                var dur = expectedContract.Duration;
                Assert.Equal(expectedContract.Id, actual[i].Id);
                Assert.Equal(expectedContract.CoachId, actual[i].CoachId);
                Assert.Equal(expectedContract.TimeStart, actual[i].TimeStart);
                Assert.Equal(expectedContract.DateStart, actual[i].DateStart);
                i++;
            }
        }
示例#2
0
 public AdminSlotsController(IUserService userService, IStringLocalizer <AdminSlotsController> localizer, ILogger <AdminSlotsController> logger, ISlotService slotService)
     : base("~/Views/AdminSlots.cshtml", userService)
 {
     _localizer   = localizer ?? throw new ArgumentNullException(nameof(localizer));
     _logger      = logger ?? throw new ArgumentNullException(nameof(logger));
     _slotService = slotService ?? throw new ArgumentNullException(nameof(slotService));
 }
示例#3
0
        private void Setup()
        {
            var options = new DbContextOptionsBuilder <ApplicationContext>().Options;

            _applicationContextMock = new Mock <ApplicationContext>(options);
            _testedService          = new SlotService(Logger, _applicationContextMock.Object);
        }
示例#4
0
        public async Task Create_Slots_Successes()
        {
            Setup();
            var slots = GenerateListOfSlots();

            var firstSlot = new SlotsReturnContract()
            {
                CoachId   = 5,
                DateStart = "02.20.2001",
                TimeStart = "11:00"
            };
            var SecondSlot = new SlotsReturnContract()
            {
                CoachId   = 5,
                DateStart = "02.20.2001",
                TimeStart = "10:00"
            };

            List <SlotsReturnContract> slotsAdd = new List <SlotsReturnContract>()
            {
                firstSlot, SecondSlot
            };

            _applicationContextMock.Setup(x => x.Slots).ReturnsDbSet(slots);

            _testedService = new SlotService(Logger, _applicationContextMock.Object);

            var result = await _testedService.AddListOfSlots(slotsAdd, CancellationToken.None);

            Assert.True(result);
        }
示例#5
0
 public OrderController(IOrderService orderService, ISlotService slotService, ICustomerService customerService, IShipperService shipperService, IOrderSService orderServiceService)
 {
     _orderService        = orderService;
     _slotService         = slotService;
     _customerService     = customerService;
     _shipperService      = shipperService;
     _orderServiceService = orderServiceService;
 }
示例#6
0
 public SlotController(
     IAsyncRepository <Slot> slotRepository,
     ISlotService slotService,
     IMapper mapper) : base(mapper)
 {
     _slotRepository = slotRepository;
     _slotService    = slotService;
 }
示例#7
0
 public ScoreboardController(IUserService userService, IStringLocalizer <ScoreboardController> localizer, IScoreboardService scoreboardService, ILabService labService, ISlotService slotService)
     : base("~/Views/Scoreboard.cshtml", userService)
 {
     _localizer         = localizer ?? throw new ArgumentNullException(nameof(localizer));
     _scoreboardService = scoreboardService ?? throw new ArgumentNullException(nameof(scoreboardService));
     _labService        = labService ?? throw new ArgumentNullException(nameof(labService));
     _slotService       = slotService ?? throw new ArgumentNullException(nameof(slotService));
 }
 public HomeController(IUserService userService, IScheduleService scheduleService, ISlotService slotService, ITaskService taskService, IColumnService columnService, IUserActivityService userActivityService)
 {
     _userService         = userService;
     _scheduleService     = scheduleService;
     _slotService         = slotService;
     _taskService         = taskService;
     _columnService       = columnService;
     _userActivityService = userActivityService;
 }
示例#9
0
 public SlotsViewModel(ISlotService slotService, IEventAggregator eventAggregator)
 {
     _slotService     = slotService;
     _eventAggregator = eventAggregator;
     _eventAggregator.GetEvent <RefreshDataEvent>().Subscribe(refreshView);
     slotList        = new ObservableCollection <Slot>();
     view            = (CollectionView)CollectionViewSource.GetDefaultView(slotList);
     SendReservation = new RelayCommand(OnSendReservationClick, CanClick);
 }
示例#10
0
 public AstreintesController(ISlotService service, ISlotRepository repository, IValidation <Slot> slotValidation, IValidation <User> userValidation, EFContext efContext, IMapper <Slot, SlotUI> slotMapper)
 {
     slotService         = service;
     slotRepository      = repository;
     this.slotValidation = slotValidation;
     this.userValidation = userValidation;
     context             = efContext;
     mapper = slotMapper;
 }
示例#11
0
        public AdminViewModel(IEventAggregator eventAggregator, ISlotService slotService)
        {
            _eventAggregator = eventAggregator;
            _slotService     = slotService;
            _eventAggregator.GetEvent <RefreshDataEvent>().Subscribe(refreshView);

            allSlotList      = new ObservableCollection <Slot>();
            view             = (CollectionView)CollectionViewSource.GetDefaultView(allSlotList);
            ClearReservation = new RelayCommand(OnClearReservationClick, CanClick);
        }
示例#12
0
 public AuthenticationController(IUserService userService, IStringLocalizer <AuthenticationController> localizer, ILogger <AuthenticationController> logger, ISlotService slotService, IConfigurationService configurationService, IWebHostEnvironment webHostEnvironment, IServiceProvider serviceProvider)
     : base("~/Views/Authentication.cshtml", userService)
 {
     _userService          = userService ?? throw new ArgumentNullException(nameof(userService));
     _localizer            = localizer ?? throw new ArgumentNullException(nameof(localizer));
     _logger               = logger ?? throw new ArgumentNullException(nameof(logger));
     _slotService          = slotService ?? throw new ArgumentNullException(nameof(slotService));
     _configurationService = configurationService ?? throw new ArgumentNullException(nameof(configurationService));
     _webHostEnvironment   = webHostEnvironment ?? throw new ArgumentNullException(nameof(webHostEnvironment));
     _serviceProvider      = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
 }
示例#13
0
 public OrderController(IOrderService orderService, ISlotService slotService, ICustomerService customerService, IShipperService shipperService, IOrderSService orderServiceService, IServiceService serviceService, IStoreService storeService, IHubContext <CenterHub> hub)
 {
     _orderService        = orderService;
     _slotService         = slotService;
     _customerService     = customerService;
     _shipperService      = shipperService;
     _orderServiceService = orderServiceService;
     _serviceService      = serviceService;
     _storeService        = storeService;
     _hub = hub;
 }
示例#14
0
 public SlotsController(
     ArtaplanContext context,
     IMapper mapper,
     ISlotService slotService,
     IStageService stageService
     )
 {
     _mapper       = mapper;
     _context      = context;
     _slotService  = slotService;
     _stageService = stageService;
 }
示例#15
0
        public async Task Get_Count_Slots_Successes()
        {
            Setup();
            var slots = GenerateListOfSlots();

            _applicationContextMock.Setup(x => x.Slots).ReturnsDbSet(slots);

            _testedService = new SlotService(Logger, _applicationContextMock.Object);

            var result = await _testedService.TakeAllSlots();

            Assert.Equal(slots.Count(), result.Count());
        }
示例#16
0
        public async Task Create_Slots_Failed()
        {
            Setup();
            var slots = GenerateListOfSlots();

            var EmptyList = new List <SlotsReturnContract>();

            _applicationContextMock.Setup(x => x.Slots).ReturnsDbSet(slots);

            _testedService = new SlotService(Logger, _applicationContextMock.Object);

            var result = await _testedService.AddListOfSlots(EmptyList, CancellationToken.None);

            Assert.False(result);
        }
示例#17
0
        public async Task Slots_Remove_Failed_Null()
        {
            Setup();
            var slots = GenerateListOfSlots();

            var EmptyList = new List <int>();

            _applicationContextMock.Setup(x => x.Slots).ReturnsDbSet(slots);

            _testedService = new SlotService(Logger, _applicationContextMock.Object);

            var result = await _testedService.RemoveSlotRange(EmptyList, CancellationToken.None);

            Assert.False(result);
        }
示例#18
0
        public async Task Slots_Remove_Successes(int id)
        {
            Setup();
            var slots = GenerateListOfSlots();

            var ByOneList = new List <int>()
            {
                id
            };

            _applicationContextMock.Setup(x => x.Slots).ReturnsDbSet(slots);

            _testedService = new SlotService(Logger, _applicationContextMock.Object);

            var result = await _testedService.RemoveSlotRange(ByOneList, CancellationToken.None);

            Assert.True(result);
        }
示例#19
0
        public async Task Slots_Update_Successes(int id)
        {
            Setup();
            var slots = GenerateListOfSlots();

            var firstSlot = new SlotsReturnContract()
            {
                Id        = id,
                CoachId   = 5,
                DateStart = "02.20.2001",
                Duration  = "10:00",
                TimeStart = "11:00"
            };

            _applicationContextMock.Setup(x => x.Slots).ReturnsDbSet(slots);

            _testedService = new SlotService(Logger, _applicationContextMock.Object);

            var result = await _testedService.UpdateSlot(firstSlot, CancellationToken.None);

            Assert.True(result);
        }
示例#20
0
 public BookingController(IBookingService bookingService, ISlotService slotService)
 {
     _bookingService = bookingService;
     _slotService    = slotService;
 }
 public SlotApiController(ISlotService slotService)
 {
     this._slotService = slotService;
 }
示例#22
0
 public SlotController(ISlotService slotService, IUserService userService, IRoomService roomService)
 {
     _slotService = slotService;
     _userService = userService;
     _roomService = roomService;
 }
示例#23
0
 public SlotController(IShipperService shipperService, ISlotService slotService, IOrderService orderService)
 {
     _shipperService = shipperService;
     _slotService    = slotService;
     _orderService   = orderService;
 }
示例#24
0
 public SlotController(ISlotService slotService, IBookingService bookingService)
 {
     _slotService    = slotService;
     _bookingService = bookingService;
 }
 public SlotController(ISlotService slotService)
 {
     _slotService = slotService;
 }
示例#26
0
 public ParkingAssistantController(ISlotService recommendedSlotProvider)
 {
     _recommendedSlotProvider = recommendedSlotProvider;
 }
示例#27
0
 public SlotController(ISlotService slotService, IUrlHelper urlHelper)
 {
     _slotService = slotService;
     _urlHelper = urlHelper;
 }
示例#28
0
        public void Setup()
        {
            _slotRepository = MockRepository.GenerateStub<ISlotRepository>();
            _slotService = new SlotService(_slotRepository);
            _urlHelper = MockRepository.GenerateStub<IUrlHelper>();
            _objectUnderTest = new SlotController(_slotService, _urlHelper);

            _objectUnderTest.Request = new HttpRequestMessage();
            _objectUnderTest.Request.SetConfiguration(new HttpConfiguration());
        }
示例#29
0
 public SlotController(ISlotService slotService)
 {
     _slotService = slotService ?? throw new ArgumentNullException(nameof(slotService));
 }
示例#30
0
 public SlotController(ISlotService slotService, IMapper mapper)
 {
     SlotService = slotService;
     Mapper      = mapper;
 }
示例#31
0
 public SlotController(ISlotService slotService, IMasterService masterService)
 {
     this.slotService = slotService;
     _masterService   = masterService;
 }
示例#32
0
 public SlotController(ISlotService slots)
 {
     Slots = slots;
 }