コード例 #1
0
        public void PropertiesRequiredValid()
        {
            var vehicle = EntitiesFactory.GetNewVehicle();

            bool result = vehicle.ValidatePropertiesRequired();

            result.Should().BeTrue();
        }
コード例 #2
0
        public async void RemoveValid()
        {
            var vehicle = EntitiesFactory.GetNewVehicle();

            _vehicleRepository.Save(vehicle).Returns(true);

            bool result = await _vehicleService.Remove(vehicle);

            result.Should().BeTrue();
        }
コード例 #3
0
        public async void GetByIdValid()
        {
            var vehicle = EntitiesFactory.GetNewVehicle();

            _vehicleRepository.GetById(vehicle.Id).Returns(vehicle);

            var result = await _vehicleService.GetById(vehicle.Id);

            result.Should().NotBeNull();
        }
コード例 #4
0
        public async void GetByIdInvalid(string id)
        {
            var vehicle = EntitiesFactory.GetNewVehicle();

            _vehicleRepository.GetById(id).Returns(vehicle);

            var result = await _vehicleService.GetById(id);

            result.Should().BeNull();
        }
コード例 #5
0
        public async void RemoveInvalid(string id)
        {
            var vehicle = EntitiesFactory.GetNewVehicle();

            vehicle.Id = id;
            _vehicleRepository.Save(vehicle).Returns(true);

            bool result = await _vehicleService.Remove(vehicle);

            result.Should().BeFalse();
        }
コード例 #6
0
        public async void GetByVehicleClassValid()
        {
            var            vehicle    = EntitiesFactory.GetNewVehicle();
            List <Vehicle> listReturn = EntitiesFactory.GetVehicleList();

            _vehicleRepository.GetByVehicleClass(vehicle.VehicleClass).Returns(listReturn);

            IEnumerable <Vehicle> result = await _vehicleService.GetByVehicleClass(vehicle.VehicleClass);

            result.Should().NotBeNull();
        }
コード例 #7
0
        public async void GetByCompanyIdValid()
        {
            List <Vehicle> listReturn = EntitiesFactory.GetVehicleList();
            var            vehicle    = EntitiesFactory.GetNewVehicle();

            listReturn.Add(vehicle);
            _vehicleRepository.GetByCompanyId(vehicle.CompanyId).Returns(listReturn);

            IEnumerable <Vehicle> result = await _vehicleService.GetByCompanyId(vehicle.CompanyId);

            result.Should().NotBeNull();
        }