import 'package:fcs/domain/entities/cargo_type.dart'; import 'package:fcs/domain/entities/carton.dart'; import 'package:fcs/domain/entities/discount_by_weight.dart'; import 'package:fcs/domain/entities/rate.dart'; import 'package:test/test.dart'; @TestOn('vm') void main() { var rate = Rate(); rate.discountByWeights = [ DiscountByWeight(weight: 25, discount: 0.25), DiscountByWeight(weight: 50, discount: 0.5), ]; rate.volumetricRatio = 166.36; rate.diffDiscountWeight = 5; rate.diffWeightRate = 1.5; test('Calculate carton price 1', () { var ct = CargoType(name: "General", weight: 10, rate: 6); var carton = Carton(cargoTypes: [ct], length: 15, width: 15, height: 15); expect(carton.calAmount(rate), equals(67.50)); }); test('Calculate carton price 2', () { var ct = CargoType(name: "General", weight: 10, rate: 6); var carton = Carton(cargoTypes: [ct], length: 10, width: 10, height: 10); expect(carton.calAmount(rate), equals(60)); }); test('Calculate carton price 3', () { var ct = CargoType(name: "General", weight: 10, rate: 6); var carton = Carton(cargoTypes: [ct], length: 15, width: 15, height: 10); expect(carton.calAmount(rate), equals(60)); }); }