forked from EdisonTalk/DesignPattern.Samples.CSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
56 lines (47 loc) · 1.87 KB
/
Program.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using Manulife.ChengDu.DesignPattern.Strategy.IntializeVersion;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Manulife.ChengDu.DesignPattern.Strategy
{
public class Program
{
public static void Main(string[] args)
{
//InitializeTest();
MovieTicket mt = new MovieTicket();
double originalPrice = 60.0;
double currentPrice = originalPrice;
mt.Price = originalPrice;
Console.WriteLine("原始票价:{0}", originalPrice);
Console.WriteLine("----------------------------------------");
IDiscount discount = AppConfigHelper.GetStrategyInstance() as IDiscount;
if (discount != null)
{
mt.Discount = discount;
currentPrice = mt.Price;
}
Console.WriteLine("折后票价:{0}", currentPrice);
Console.ReadKey();
}
public static void InitializeTest()
{
//MovieTicket mt = new MovieTicket();
//double originalPrice = 60.0; // 原始票价
//double currentPrice; // 折后票价
//mt.Price = originalPrice;
//Console.WriteLine("原始票价:{0}", originalPrice);
//Console.WriteLine("----------------------------------------");
//mt.Type = "student";
//currentPrice = mt.Calculate();
//Console.WriteLine("折后票价:{0}", currentPrice);
//Console.WriteLine("----------------------------------------");
//mt.Type = "children";
//currentPrice = mt.Calculate();
//Console.WriteLine("折后票价:{0}", currentPrice);
//Console.WriteLine("----------------------------------------");
}
}
}