public async Task ShouldNotAllowOrdersIfDispatcherGroupIsDifferent() { var basicOrderRule = new BasicOrderRule(_mockGasStationRepo.Object, _mockCarrierRepo.Object); var result = await basicOrderRule.ValidateOrders(_orderData.InputOrders, 2); Assert.False(result); }
public async Task ShouldNotAllowOrdersIfCarrierMaxGallonsExceeds() { var carrierId = _orderData.Carriers.LastOrDefault().Id; var basicOrderRule = new BasicOrderRule(_mockGasStationRepo.Object, _mockCarrierRepo.Object); var result = await basicOrderRule.ValidateOrders(_orderData.InputOrders .Where(x => x.CarrierId == carrierId), 2); Assert.False(result); }
public async Task ShouldNotAllowOrdersIfCarrierIsDifferent() { var carrierId1 = _orderData.Carriers.FirstOrDefault().Id; var carrierId2 = _orderData.Carriers.Skip(1).FirstOrDefault().Id; var basicOrderRule = new BasicOrderRule(_mockGasStationRepo.Object, _mockCarrierRepo.Object); var result = await basicOrderRule.ValidateOrders(_orderData.InputOrders .Where(x => x.CarrierId == carrierId1 || x.CarrierId == carrierId2), 2); Assert.False(result); }
public async Task ShouldAllowOrdersWhenAllRulesPass() { var carrierId = _orderData.Carriers.FirstOrDefault().Id; var gasStationId = _orderData.GasStations.LastOrDefault().Id; var basicOrderRule = new BasicOrderRule(_mockGasStationRepo.Object, _mockCarrierRepo.Object); var result = await basicOrderRule.ValidateOrders(_orderData.InputOrders .Where(x => x.CarrierId == carrierId && x.GasStationId != gasStationId), 2); Assert.True(result); }
public async Task ShouldAllowOrdersIfOrderDeliveryTimeIsNotWithInCarrierDeliveryTimeRangeAndTreshold() { var carrierId = _orderData.Carriers.Skip(1).FirstOrDefault().Id; var basicOrderRule = new BasicOrderRule(_mockGasStationRepo.Object, _mockCarrierRepo.Object); var result = await basicOrderRule.ValidateOrders(_orderData.InputOrders .Where(x => x.CarrierId == carrierId) , 2); Assert.True(result); }