1 // Copyright (C) 2019 Kazuhiro Fujieda <fujieda@users.osdn.me>
\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
7 // http://www.apache.org/licenses/LICENSE-2.0
\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
15 using KancolleSniffer.Model;
\r
16 using KancolleSniffer.View.MainWindow;
\r
17 using Microsoft.VisualStudio.TestTools.UnitTesting;
\r
19 namespace KancolleSniffer.Test
\r
22 public class RepairShipCountTest
\r
25 public void TestCreateRepairShipCountString()
\r
27 Assert.AreEqual("なし", new RepairShipCount(new ShipStatus[0]).ToString());
\r
30 const int minor = 30;
\r
31 const int small = (int)(max * 0.75);
\r
32 const int half = (int)(max * 0.5);
\r
33 const int badly = (int)(max * 0.25);
\r
35 var repairList = new[]
\r
37 new ShipStatus {NowHp = minor, MaxHp = max},
\r
38 new ShipStatus {NowHp = minor, MaxHp = max},
\r
39 new ShipStatus {NowHp = minor, MaxHp = max},
\r
40 new ShipStatus {NowHp = minor, MaxHp = max}
\r
42 Assert.AreEqual("軽微 4", new RepairShipCount(repairList).ToString());
\r
44 repairList[0].NowHp = small;
\r
45 Assert.AreEqual("軽微 3\r\n小破 1\r\n 計 4",
\r
46 new RepairShipCount(repairList).ToString());
\r
48 repairList[1].NowHp = half;
\r
49 Assert.AreEqual("軽微 2\r\n小破 1\r\n 計 3\r\n中破 1\r\n 計 1",
\r
50 new RepairShipCount(repairList).ToString());
\r
52 repairList[2].NowHp = badly;
\r
53 Assert.AreEqual("軽微 1\r\n小破 1\r\n 計 2\r\n中破 1\r\n大破 1\r\n 計 2",
\r
54 new RepairShipCount(repairList).ToString());
\r
56 repairList[3].NowHp = small;
\r
57 Assert.AreEqual("小破 2\r\n 計 2\r\n中破 1\r\n大破 1\r\n 計 2",
\r
58 new RepairShipCount(repairList).ToString());
\r
60 repairList[1].NowHp = badly;
\r
61 Assert.AreEqual("小破 2\r\n大破 2",
\r
62 new RepairShipCount(repairList).ToString());
\r
64 repairList[0].NowHp = half;
\r
65 repairList[3].NowHp = half;
\r
66 repairList[1].NowHp = badly;
\r
67 Assert.AreEqual("中破 2\r\n大破 2\r\n 計 4",
\r
68 new RepairShipCount(repairList).ToString());
\r
70 repairList[0].NowHp = badly;
\r
71 repairList[3].NowHp = badly;
\r
72 Assert.AreEqual("大破 4",
\r
73 new RepairShipCount(repairList).ToString());
\r