OSDN Git Service

MainShipLabelsにPanelを移してShipPanelsにする
[kancollesniffer/KancolleSniffer.git] / KancolleSniffer.Test / ChargeStatusTest.cs
1 // Copyright (C) 2019 Kazuhiro Fujieda <fujieda@users.osdn.me>\r
2 //\r
3 // Licensed under the Apache License, Version 2.0 (the "License");\r
4 // you may not use this file except in compliance with the License.\r
5 // You may obtain a copy of the License at\r
6 //\r
7 //    http://www.apache.org/licenses/LICENSE-2.0\r
8 //\r
9 // Unless required by applicable law or agreed to in writing, software\r
10 // distributed under the License is distributed on an "AS IS" BASIS,\r
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
12 // See the License for the specific language governing permissions and\r
13 // limitations under the License.\r
14 \r
15 using ExpressionToCodeLib;\r
16 using KancolleSniffer.Model;\r
17 using Microsoft.VisualStudio.TestTools.UnitTesting;\r
18 // ReSharper disable CompareOfFloatsByEqualityOperator\r
19 \r
20 namespace KancolleSniffer.Test\r
21 {\r
22     [TestClass]\r
23     public class ChargeStatusTest\r
24     {\r
25         private readonly Fleet _fleet = new Fleet(null, 6, null);\r
26 \r
27         [TestMethod]\r
28         public void NoShips()\r
29         {\r
30             var stat = _fleet.ChargeStatus;\r
31             PAssert.That(() => stat.Fuel == 0 && stat.Bull == 0);\r
32             PAssert.That(() => stat.Empty);\r
33         }\r
34 \r
35         [TestMethod]\r
36         public void FullFlagshipOnly()\r
37         {\r
38             var fs =_fleet.Ships[0];\r
39             fs.Fuel = 9;\r
40             fs.Spec.FuelMax = 9;\r
41             fs.Bull = 9;\r
42             fs.Spec.BullMax = 9;\r
43             var stat = _fleet.ChargeStatus;\r
44             PAssert.That(() => stat.Fuel == 0 && stat.FuelRatio == 1);\r
45             PAssert.That(() => stat.Bull == 0 && stat.BullRatio == 1);\r
46         }\r
47 \r
48         [TestMethod]\r
49         public void FlagshipOnly()\r
50         {\r
51             var fs = _fleet.Ships[0];\r
52             fs.Fuel = 3;\r
53             fs.Spec.FuelMax = 9;\r
54             fs.Bull = 0;\r
55             fs.Spec.BullMax = 9;\r
56             var stat = _fleet.ChargeStatus;\r
57             PAssert.That(() => stat.Fuel == 2 && stat.FuelRatio == 3 / 9.0);\r
58             PAssert.That(() => stat.Bull == 4 && stat.BullRatio == 0.0);\r
59         }\r
60 \r
61         [TestMethod]\r
62         public void FullFlagshipAndFullOther()\r
63         {\r
64             var fs = _fleet.Ships[0];\r
65             fs.Fuel = 9;\r
66             fs.Spec.FuelMax = 9;\r
67             fs.Bull = 9;\r
68             fs.Spec.BullMax = 9;\r
69             var other = _fleet.Ships[1];\r
70             other.Fuel = 9;\r
71             other.Spec.FuelMax = 9;\r
72             other.Bull = 9;\r
73             other.Spec.BullMax = 9;\r
74             var stat = _fleet.ChargeStatus;\r
75             PAssert.That(() => stat.Fuel == 5 && stat.FuelRatio == 1);\r
76             PAssert.That(() => stat.Bull == 5 && stat.BullRatio == 1);\r
77         }\r
78 \r
79         [TestMethod]\r
80         public void FullFlagshipAndOther()\r
81         {\r
82             var fs = _fleet.Ships[0];\r
83             fs.Fuel = 9;\r
84             fs.Spec.FuelMax = 9;\r
85             fs.Bull = 9;\r
86             fs.Spec.BullMax = 9;\r
87             var other = _fleet.Ships[1];\r
88             other.Fuel = 7;\r
89             other.Spec.FuelMax = 9;\r
90             other.Bull = 3;\r
91             other.Spec.BullMax = 9;\r
92             var stat = _fleet.ChargeStatus;\r
93             PAssert.That(() => stat.Fuel == 6 && stat.FuelRatio == 7 / 9.0);\r
94             PAssert.That(() => stat.Bull == 7 && stat.BullRatio == 3 / 9.0);\r
95         }\r
96 \r
97         [TestMethod]\r
98         public void FullFlagshipAndOthers()\r
99         {\r
100             var fs = _fleet.Ships[0];\r
101             fs.Fuel = 9;\r
102             fs.Spec.FuelMax = 9;\r
103             fs.Bull = 9;\r
104             fs.Spec.BullMax = 9;\r
105             var second = _fleet.Ships[1];\r
106             second.Fuel = 3;\r
107             second.Spec.FuelMax = 9;\r
108             second.Bull = 9;\r
109             second.Spec.BullMax = 9;\r
110             var third = _fleet.Ships[2];\r
111             third.Fuel = 7;\r
112             third.Spec.FuelMax = 9;\r
113             third.Bull = 0;\r
114             third.Spec.BullMax = 9;\r
115             var stat = _fleet.ChargeStatus;\r
116             PAssert.That(() => stat.Fuel == 7 && stat.FuelRatio == 3 / 9.0);\r
117             PAssert.That(() => stat.Bull == 9 && stat.BullRatio == 0.0);\r
118         }\r
119     }\r
120 }