public async Task GetAllAutosTest()
        {
            // arrange
            List <Auto> listAutos = await _target.GetAll();

            // act
            // assert
            Assert.True(listAutos.Count == 4, "Count Should be 4 not: " + listAutos.Count);
        }
Пример #2
0
        public override async Task <AutoAllDto> GetAll(Empty request, ServerCallContext context)
        {
            List <AutoDto> dtos = await CarManager.GetAll().ConvertToDtos();

            AutoAllDto result = new AutoAllDto();

            dtos.ForEach(autoDto => result.Cars.Add(autoDto));
            return(result);
        }
Пример #3
0
        public override async Task <AutosDto> GetAll(Empty request, ServerCallContext context)
        {
            AutoManager manager = new AutoManager();
            List <Auto> allCars = await manager.GetAll();

            List <AutoDto> dtos     = allCars.ConvertToDtos();
            AutosDto       autosDto = new AutosDto();

            dtos.ForEach(autoDto => autosDto.Cars.Add(autoDto));
            return(autosDto);
        }
Пример #4
0
 public override async Task <AutoDtoList> GetAutos(Empty request, ServerCallContext context)
 {
     try
     {
         var response = new AutoDtoList();
         response.Items.AddRange(await _manager.GetAll().ConvertToDtos());
         return(response);
     }
     catch (Exception)
     {
         throw new RpcException(new Status(StatusCode.Internal, "Internal error occured."));
     }
 }
Пример #5
0
        public override async Task <AllAutos> GetAll(Empty request, ServerCallContext context)
        {
            AutoManager manager  = new AutoManager();
            List <Auto> autoList = await manager.GetAll();

            AllAutos allAutoDto = new AllAutos();

            foreach (Auto k in autoList)
            {
                allAutoDto.Auto.Add(k.ConvertToDto());
            }
            return(allAutoDto);
        }
        public void ScenarioOkay01Test_NoReservationsForCarYet()
        {
            var car = new StandardAuto
            {
                Brand     = "PaddyWaggon",
                DailyRate = 120
            };

            var autoManager = new AutoManager();

            autoManager.Create(car);

            var reservation = new Reservation
            {
                Auto    = autoManager.GetAll().OrderBy(c => c.Id).Last(),
                KundeId = 1,
                From    = DateTime.Today,
                To      = DateTime.Today.AddDays(2)
            };

            ReservationManager.CheckCarAvailability(reservation, Target);
        }
 public IEnumerable <AutoDto> ReadAllAutos()
 {
     WriteActualMethod();
     return(_autoManager.GetAll().ConvertToDtos());
 }
Пример #8
0
        public async Task GetAllTest()
        {
            var result = await _target.GetAll();

            Assert.Equal(4, result.Count);
        }