예제 #1
0
        public async void Calculate_Same_Year()
        {
            //Given
            var priceCommand = new CalculateIsuranceBasePrice(VehicleType.Car, 2005, "Troller", "Geep");
            //When
            var handler  = new CalculateIsuranceBasePriceCommandHandler(_mediator.Object, _isurancePriceRepository.Object);
            var cltToken = new System.Threading.CancellationToken();
            var result   = handler.Handle(priceCommand, cltToken);
            //Then
            decimal expected = 1245;

            Assert.True(expected == await result);
        }
        public async Task Handle(QuoteRequestedIntegrationEvent @event)
        {
            var InsurenceQuoting = await _repository.GetAsync(@event.RequestKey);

            var veh = InsurenceQuoting.Vehicle;
            var calculateRequest = new CalculateIsuranceBasePrice(veh.VehicleType, int.Parse(veh.ManufacturingYear), veh.Model, veh.Make);

            InsurenceQuoting.QuoteProcessStatus.ValueQuoted = await _mediator.Send(calculateRequest);

            InsurenceQuoting.QuoteProcessStatus.ValueQuoted *= (decimal)InsurenceQuoting.Customer.Modifier;
            InsurenceQuoting.QuoteProcessStatus.Status       = QuoteStatus.Done;
            _repository.AddOrUpdateAsync(InsurenceQuoting);
        }
예제 #3
0
        public async void Roungh_Type_Of_Vehicle()
        {
            //Given
            var priceCommand = new CalculateIsuranceBasePrice(VehicleType.Motocycle, 2000, "Fit", "Honda");
            //When
            var handler  = new CalculateIsuranceBasePriceCommandHandler(_mediator.Object, _isurancePriceRepository.Object);
            var cltToken = new System.Threading.CancellationToken();
            var result   = handler.Handle(priceCommand, cltToken);
            //Then
            decimal expected = 1001;

            Assert.True(expected == await result);
        }