summaryrefslogtreecommitdiff
path: root/Plugins/MonoGame.Extended/tests/MonoGame.Extended.Tests/Primitives/Size2Tests.cs
blob: faaa42677c17890c67405c76607ddd10353f626c (plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
//using System.Collections.Generic;
//using System.Globalization;
//using Microsoft.Xna.Framework;
//using Xunit;

//namespace MonoGame.Extended.Tests.Primitives
//{
//    
//    public class Size2Tests
//    {
//        public IEnumerable<TestCaseData> ConstructorTestCases
//        {
//            get
//            {
//                yield return
//                    new TestCaseData(0, 0).SetName(
//                        "The empty size has the expected dimensions.");
//                yield return
//                    new TestCaseData(float.MinValue, float.MaxValue).SetName
//                    (
//                        "A non-empty size has the expected dimensions.");
//            }
//        }

//        [Fact]
//        [TestCaseSource(nameof(ConstructorTestCases))]
//        public void Constructor(float width, float height)
//        {
//            var size = new Size2(width, height);
//            Assert.Equal(width, size.Width);
//            Assert.Equal(height, size.Height);
//        }

//        public IEnumerable<TestCaseData> DimensionsTestCases
//        {
//            get
//            {
//                yield return
//                    new TestCaseData(new Size2(), 0, 0).SetName(
//                        "The empty size has the expected dimensions.");
//                yield return
//                    new TestCaseData(new Size2(float.MinValue, float.MaxValue), float.MinValue, float.MaxValue).SetName
//                    (
//                        "A non-empty size has the expected dimensions.");
//            }
//        }

//        [Fact]
//        [TestCaseSource(nameof(DimensionsTestCases))]
//        public void Dimensions(Size2 size, float expectedWidth, float expecetedHeight)
//        {
//            Assert.Equal(expectedWidth, size.Width);
//            Assert.Equal(expecetedHeight, size.Height);

//            size.Width = 10;
//            Assert.Equal(10, size.Width);

//            size.Height = -10.123f;
//            Assert.Equal(-10.123f, size.Height);
//        }

//        public IEnumerable<TestCaseData> AdditionTestCases
//        {
//            get
//            {
//                yield return
//                    new TestCaseData(new Size2(), new Size2(), new Size2()).SetName(
//                        "The addition of two empty sizes is the empty size.");
//                yield return
//                    new TestCaseData(new Size2(5, 5), new Size2(15, 15), new Size2(20, 20)).SetName(
//                        "The addition of two non-empty sizes is the expected size.");
//            }
//        }

//        [Fact]
//        [TestCaseSource(nameof(AdditionTestCases))]
//        public void Addition(Size2 size1, Size2 size2, Size2 expectedSize)
//        {
//            Assert.Equal(expectedSize, size1 + size2);
//            Assert.Equal(expectedSize, Size2.Add(size1, size2));
//        }

//        public IEnumerable<TestCaseData> SubtractionTestCases
//        {
//            get
//            {
//                yield return
//                    new TestCaseData(new Size2(), new Size2(), new Size2()).SetName(
//                        "The subtraction of two empty sizes is the empty size.");
//                yield return
//                    new TestCaseData(new Size2(5, 5), new Size2(15, 15), new Size2(-10, -10)).SetName(
//                        "The subtraction of two non-empty sizes is the expected size.");
//            }
//        }

//        [Fact]
//        [TestCaseSource(nameof(SubtractionTestCases))]
//        public void Subtraction(Size2 size1, Size2 size2, Size2 expectedSize)
//        {
//            Assert.Equal(expectedSize, size1 - size2);
//            Assert.Equal(expectedSize, Size2.Subtract(size1, size2));
//        }

//        public IEnumerable<TestCaseData> EqualityTestCases
//        {
//            get
//            {
//                yield return
//                    new TestCaseData(new Size2(), new Size2(), true).SetName("Two empty sizes are equal.");
//                yield return
//                    new TestCaseData(new Size2(float.MinValue, float.MaxValue),
//                        new Size2(float.MaxValue, float.MinValue), false).SetName(
//                        "Two different non-empty sizes are not equal.");
//                yield return
//                    new TestCaseData(
//                            new Size2(float.MinValue, float.MaxValue), new Size2(float.MinValue, float.MaxValue), true)
//                        .SetName(
//                            "Two identical non-empty sizes are equal.");
//            }
//        }

//        [Fact]
//        [TestCaseSource(nameof(EqualityTestCases))]
//        public void Equality(Size2 size1, Size2 size2, bool expectedToBeEqual)
//        {
//            Assert.IsTrue(Equals(size1, size2) == expectedToBeEqual);
//            Assert.IsTrue(size1 == size2 == expectedToBeEqual);
//            Assert.IsFalse(size1 == size2 != expectedToBeEqual);
//            Assert.IsTrue(size1.Equals(size2) == expectedToBeEqual);

//            if (expectedToBeEqual)
//                Assert.Equal(size1.GetHashCode(), size2.GetHashCode());
//        }

//        public IEnumerable<TestCaseData> InequalityTestCases
//        {
//            get
//            {
//                yield return
//                    new TestCaseData(new Size2(), null, false).SetName("A size is not equal to a null object.");
//                yield return
//                    new TestCaseData(new Size2(), new object(), false).SetName(
//                        "A size is not equal to an instantiated object.");
//            }
//        }

//        [Fact]
//        [TestCaseSource(nameof(InequalityTestCases))]
//        public void Inequality(Size2 size, object obj, bool expectedToBeEqual)
//        {
//            Assert.IsTrue(size.Equals(obj) == expectedToBeEqual);
//        }

//        public IEnumerable<TestCaseData> HashCodeTestCases
//        {
//            get
//            {
//                yield return
//                    new TestCaseData(new Size2(), new Size2(), true).SetName(
//                        "Two empty sizes have the same hash code.");
//                yield return
//                    new TestCaseData(new Size2(50, 50), new Size2(50, 50), true).SetName(
//                        "Two indentical non-empty sizes have the same hash code.");
//                yield return
//                    new TestCaseData(new Size2(0, 0), new Size2(50, 50), false).SetName(
//                        "Two different non-empty sizes do not have the same hash code.");
//            }
//        }

//        [Fact]
//        [TestCaseSource(nameof(HashCodeTestCases))]
//        public void HashCode(Size2 size1, Size2 size2, bool expectedThatHashCodesAreEqual)
//        {
//            var hashCode1 = size1.GetHashCode();
//            var hashCode2 = size2.GetHashCode();
//            if (expectedThatHashCodesAreEqual)
//                Assert.Equal(hashCode1, hashCode2);
//            else
//                Assert.AreNotEqual(hashCode1, hashCode2);
//        }

//        public IEnumerable<TestCaseData> ToPointTestCases
//        {
//            get
//            {
//                yield return
//                    new TestCaseData(new Size2(), new Point2()).SetName("The empty size converted to a point is the zero point.");
//                yield return
//                    new TestCaseData(new Size2(float.MinValue, float.MaxValue), new Point2(float.MinValue, float.MaxValue)).SetName(
//                        "A non-empty size converted to a point is the expected point.");
//            }
//        }

//        [Fact]
//        [TestCaseSource(nameof(ToPointTestCases))]
//        public void ToPoint(Size2 size, Point2 expectedPoint)
//        {
//            var actualPoint = (Point2)size;
//            Assert.Equal(expectedPoint, actualPoint);
//        }

//        public IEnumerable<TestCaseData> FromPointTestCases
//        {
//            get
//            {
//                yield return
//                    new TestCaseData(new Point2(), new Size2()).SetName("The zero point converted to a size is the empty size.");
//                yield return
//                    new TestCaseData(new Point2(float.MinValue, float.MaxValue), new Size2(float.MinValue, float.MaxValue)).SetName(
//                        "A non-zero point converted to a size is the expected size.");
//            }
//        }

//        [Fact]
//        [TestCaseSource(nameof(FromPointTestCases))]
//        public void FromPoint(Point2 point, Size2 expectedSize)
//        {
//            var actualSize = (Size2)point;
//            Assert.Equal(expectedSize, actualSize);
//        }

//        public IEnumerable<TestCaseData> ToVectorTestCases
//        {
//            get
//            {
//                yield return
//                    new TestCaseData(new Size2(), new Vector2()).SetName("The empty size converted to a vector is the zero vector.");
//                yield return
//                    new TestCaseData(new Size2(float.MinValue, float.MaxValue), new Vector2(float.MinValue, float.MaxValue)).SetName(
//                        "A non-empty size converted to a vector is the expected vector.");
//            }
//        }

//        [Fact]
//        [TestCaseSource(nameof(ToVectorTestCases))]
//        public void ToVector(Size2 size, Vector2 expectedVector)
//        {
//            var actualVector = (Vector2)size;
//            Assert.Equal(expectedVector, actualVector);
//        }

//        public IEnumerable<TestCaseData> FromVectorTestCases
//        {
//            get
//            {
//                yield return
//                    new TestCaseData(new Vector2(), new Size2()).SetName("The zero vector converted to a size is the empty size.");
//                yield return
//                    new TestCaseData(new Vector2(float.MinValue, float.MaxValue), new Size2(float.MinValue, float.MaxValue)).SetName(
//                        "A non-zero vector converted to a size is the expected size.");
//            }
//        }

//        [Fact]
//        [TestCaseSource(nameof(FromVectorTestCases))]
//        public void FromVector(Vector2 vector, Size2 expectedSize)
//        {
//            var actualSize = (Size2)vector;
//            Assert.Equal(expectedSize, actualSize);
//        }

//        //public IEnumerable<TestCaseData> FromSizeTestCases
//        //{
//        //    get
//        //    {
//        //        yield return
//        //            new TestCaseData(new Size2(), new Size2()).SetName("The empty size converted to a size is the empty size.");
//        //        yield return
//        //            new TestCaseData(new Size2(int.MinValue, int.MaxValue), new Size2(int.MinValue, int.MaxValue)).SetName(
//        //                "A non-zero size converted to a size is the expected size.");
//        //    }
//        //}

//        //[Fact]
//        //[TestCaseSource(nameof(FromSizeTestCases))]
//        //public void FromSize(Size2 size, Size2 expectedSize)
//        //{
//        //    var actualSize = (Size2)size;
//        //    Assert.Equal(expectedSize, actualSize);
//        //}

//        public IEnumerable<TestCaseData> StringCases
//        {
//            get
//            {
//                yield return
//                    new TestCaseData(new Size2(),
//                        string.Format(CultureInfo.CurrentCulture, "Width: {0}, Height: {1}", 0, 0)).SetName(
//                        "The empty size has the expected string representation using the current culture.");
//                yield return new TestCaseData(new Size2(5.1f, -5.123f),
//                    string.Format(CultureInfo.CurrentCulture, "Width: {0}, Height: {1}", 5.1f, -5.123f)).SetName(
//                    "A non-empty size has the expected string representation using the current culture.");
//            }
//        }

//        [Fact]
//        [TestCaseSource(nameof(StringCases))]
//        public void String(Size2 size, string expectedString)
//        {
//            var actualString = size.ToString();
//            Assert.Equal(expectedString, actualString);
//        }
//    }
//}