開発に使用するリポジトリ
Revisión | 8339e3c6dce9c525c935494a29ed01aa35b2b0e9 (tree) |
---|---|
Tiempo | 2012-12-30 22:56:19 |
Autor | Kimura Youichi <kim.upsilon@bucy...> |
Commiter | Kimura Youichi |
PostClassテストコード修正
@@ -74,18 +74,24 @@ namespace OpenTween | ||
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
77 | - private static Dictionary<long, PostClass> TestCases = new Dictionary<long, PostClass> | |
77 | + private static Dictionary<long, PostClass> TestCases; | |
78 | + | |
79 | + [SetUp] | |
80 | + public void SetUpTestCases() | |
78 | 81 | { |
79 | - {1L, new TestPostClass(statusId: 1L)}, | |
80 | - {2L, new TestPostClass(statusId: 2L, IsFav: true)}, | |
81 | - {3L, new TestPostClass(statusId: 3L, IsFav: false, RetweetedId: 2L)}, | |
82 | - }; | |
82 | + PostClassTest.TestCases = new Dictionary<long, PostClass> | |
83 | + { | |
84 | + {1L, new TestPostClass(statusId: 1L)}, | |
85 | + {2L, new TestPostClass(statusId: 2L, IsFav: true)}, | |
86 | + {3L, new TestPostClass(statusId: 3L, IsFav: false, RetweetedId: 2L)}, | |
87 | + }; | |
88 | + } | |
83 | 89 | |
84 | 90 | [Test] |
85 | 91 | public void CloneTest() |
86 | 92 | { |
87 | 93 | var post = new PostClass(); |
88 | - var clonePost = ((ICloneable)post).Clone() as PostClass; | |
94 | + var clonePost = post.Clone(); | |
89 | 95 | |
90 | 96 | TestUtils.CheckDeepCloning(post, clonePost); |
91 | 97 | } |
@@ -103,12 +109,26 @@ namespace OpenTween | ||
103 | 109 | [TestCase(1L, Result = false)] |
104 | 110 | [TestCase(2L, Result = true)] |
105 | 111 | [TestCase(3L, Result = true)] |
106 | - public bool IsFavTest(long statusId) | |
112 | + public bool GetIsFavTest(long statusId) | |
107 | 113 | { |
108 | 114 | return PostClassTest.TestCases[statusId].IsFav; |
109 | 115 | } |
110 | 116 | |
111 | 117 | [Test, Combinatorial] |
118 | + public void SetIsFavTest( | |
119 | + [Values(2L, 3L)] long statusId, | |
120 | + [Values(true, false)] bool isFav) | |
121 | + { | |
122 | + var post = PostClassTest.TestCases[statusId]; | |
123 | + | |
124 | + post.IsFav = isFav; | |
125 | + Assert.That(post.IsFav, Is.EqualTo(isFav)); | |
126 | + | |
127 | + if (post.RetweetedId != 0) | |
128 | + Assert.That(PostClassTest.TestCases[post.RetweetedId].IsFav, Is.EqualTo(isFav)); | |
129 | + } | |
130 | + | |
131 | + [Test, Combinatorial] | |
112 | 132 | public void StateIndexTest( |
113 | 133 | [Values(true, false)] bool protect, |
114 | 134 | [Values(true, false)] bool mark, |