-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTest.cs
38 lines (34 loc) · 1.32 KB
/
Test.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Xunit;
namespace strategy.pattern
{
public class Test
{
[Fact]
public void When_shipping_via_UPS_The_shipping_cost_is_425()
{
var strategy = new UpsShippingCostStrategy();
var shippingCalculatorService = new ShippingCostCalculatorService(strategy);
var order = TestInit.CreateOrder_UPS();
var cost = shippingCalculatorService.CalculateShippingCost(order);
Assert.Equal(4.25d, cost);
}
[Fact]
public void When_shipping_via_USPS_The_shipping_cost_is_300()
{
var strategy = new UspsShippingCostStrategy();
var shippingCalculatorService = new ShippingCostCalculatorService(strategy);
var order = TestInit.CreateOrder_USPS();
var cost = shippingCalculatorService.CalculateShippingCost(order);
Assert.Equal(3.00d, cost);
}
[Fact]
public void When_shipping_via_FedEx_The_shipping_cost_is_5()
{
var strategy = new FedExShippingCostStrategy();
var shippingCalculatorService = new ShippingCostCalculatorService(strategy);
var order = TestInit.CreateOrder_FedEx();
var cost = shippingCalculatorService.CalculateShippingCost(order);
Assert.Equal(5.00d, cost);
}
}
}