Develop and Download Open Source Software

Browse Subversion Repository

Contents of /ShogiNextMove.Test/TeTest.vb

Parent Directory Parent Directory | Revision Log Revision Log


Revision 76 - (show annotations) (download)
Mon Feb 22 06:48:06 2016 UTC (8 years ago) by bellyoshi
File size: 4305 byte(s)


1 Imports Microsoft.VisualStudio.TestTools.UnitTesting
2
3 Imports ShogiNextMove.Board
4
5
6
7 '''<summary>
8 '''TeTest のテスト クラスです。すべての
9 '''TeTest 単体テストをここに含めます
10 '''</summary>
11 <TestClass()> _
12 Public Class TeTest
13
14
15 Private testContextInstance As TestContext
16
17 '''<summary>
18 '''現在のテストの実行についての情報および機能を
19 '''提供するテスト コンテキストを取得または設定します。
20 '''</summary>
21 Public Property TestContext() As TestContext
22 Get
23 Return testContextInstance
24 End Get
25 Set(value As TestContext)
26 testContextInstance = Value
27 End Set
28 End Property
29
30 #Region "追加のテスト属性"
31 '
32 'テストを作成するときに、次の追加属性を使用することができます:
33 '
34 'クラスの最初のテストを実行する前にコードを実行するには、ClassInitialize を使用
35 '<ClassInitialize()> _
36 'Public Shared Sub MyClassInitialize(ByVal testContext As TestContext)
37 'End Sub
38 '
39 'クラスのすべてのテストを実行した後にコードを実行するには、ClassCleanup を使用
40 '<ClassCleanup()> _
41 'Public Shared Sub MyClassCleanup()
42 'End Sub
43 '
44 '各テストを実行する前にコードを実行するには、TestInitialize を使用
45 '<TestInitialize()> _
46 'Public Sub MyTestInitialize()
47 'End Sub
48 '
49 '各テストを実行した後にコードを実行するには、TestCleanup を使用
50 '<TestCleanup()> _
51 'Public Sub MyTestCleanup()
52 'End Sub
53 '
54 #End Region
55
56
57 '''<summary>
58 '''MustPromote のテスト
59 '''</summary>
60 <TestMethod()> _
61 Public Sub MustPromoteTest()
62 Dim target1 As Te = New Te(KomaLocation.Mochigoma, New KomaLocation(9, 2), Koma.SENTE_KEI, False)
63 Dim target2 As Te = New Te(New KomaLocation(4, 5), New KomaLocation(5, 3), Koma.SENTE_KEI, False)
64 Dim target3 As Te = New Te(New KomaLocation(2, 4), New KomaLocation(2, 3), Koma.SENTE_FU, False)
65 Dim target4 As Te = New Te(New KomaLocation(2, 2), New KomaLocation(2, 1), Koma.SENTE_FU, False)
66 Dim target5 As Te = New Te(KomaLocation.Mochigoma, New KomaLocation(9, 9), Koma.GOTE_KEI, False)
67 Dim target6 As Te = New Te(New KomaLocation(6, 5), New KomaLocation(5, 7), Koma.GOTE_KEI, False)
68 Dim target7 As Te = New Te(New KomaLocation(8, 6), New KomaLocation(8, 7), Koma.GOTE_FU, False)
69 Dim target8 As Te = New Te(New KomaLocation(8, 8), New KomaLocation(8, 9), Koma.GOTE_FU, False)
70 Dim target9 As Te = New Te(New KomaLocation(9, 1), New KomaLocation(9, 9), Koma.GOTE_KYO, False)
71 Dim target10 As Te = New Te(New KomaLocation(9, 1), New KomaLocation(9, 8), Koma.GOTE_KYO, False)
72 Dim target11 As Te = New Te(KomaLocation.Mochigoma, KomaLocation.Mochigoma, Koma.SENTE_FU, False)
73 Dim target12 As Te = New Te(KomaLocation.Mochigoma, KomaLocation.KomaBako, Koma.SENTE_FU, False)
74 Assert.AreEqual(True, target1.MustPromote)
75 Assert.AreEqual(False, target2.MustPromote)
76 Assert.AreEqual(False, target3.MustPromote)
77 Assert.AreEqual(True, target4.MustPromote)
78 Assert.AreEqual(True, target5.MustPromote)
79 Assert.AreEqual(False, target6.MustPromote)
80 Assert.AreEqual(False, target7.MustPromote)
81 Assert.AreEqual(True, target8.MustPromote)
82 Assert.AreEqual(True, target9.MustPromote)
83 Assert.AreEqual(False, target10.MustPromote)
84 Assert.AreEqual(False, target11.MustPromote)
85 Assert.AreEqual(False, target12.MustPromote)
86 End Sub
87
88 '''<summary>
89 '''Equals のテスト
90 '''</summary>
91 <TestMethod()> _
92 Public Sub EqualsTest()
93 Dim target As Te = New Te(New KomaLocation(3, 3), New KomaLocation(3, 4), Koma.GOTE_FU, False)
94 Dim comp As Te = New Te(New KomaLocation(3, 3), New KomaLocation(3, 4), Koma.GOTE_FU, False)
95 Dim comp2 As Te = New Te(KomaLocation.Mochigoma, New KomaLocation(3, 4), Koma.GOTE_FU, False)
96 Assert.IsTrue(target.Equals(comp))
97 Assert.IsFalse(target.Equals(comp2))
98 End Sub
99 End Class

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26