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
|
//using System;
//using MonoGame.Extended.Particles;
//using Xunit;
//namespace MonoGame.Extended.Tests.Particles
//{
//
// public class ParticleBufferTests
// {
// public class AvailableProperty
// {
// [Fact]
// public void WhenNoParticlesReleased_ReturnsBufferSize()
// {
// var subject = new ParticleBuffer(100);
// Assert.Equal(subject.Available, 100);
// }
// [Fact]
// public void WhenSomeParticlesReleased_ReturnsAvailableCount()
// {
// var subject = new ParticleBuffer(100);
// subject.Release(10);
// Assert.Equal(subject.Available, 90);
// }
// [Fact]
// public void WhenAllParticlesReleased_ReturnsZero()
// {
// var subject = new ParticleBuffer(100);
// subject.Release(100);
// Assert.Equal(subject.Available, 0);
// }
// }
// public class CountProperty
// {
// [Fact]
// public void WhenNoParticlesReleased_ReturnsZero()
// {
// var subject = new ParticleBuffer(100);
// Assert.Equal(subject.Count, 0);
// }
// [Fact]
// public void WhenSomeParticlesReleased_ReturnsCount()
// {
// var subject = new ParticleBuffer(100);
// subject.Release(10);
// Assert.Equal(subject.Count, 10);
// }
// [Fact]
// public void WhenAllParticlesReleased_ReturnsZero()
// {
// var subject = new ParticleBuffer(100);
// subject.Release(100);
// Assert.Equal(subject.Count, 100);
// }
// }
// public class ReleaseMethod
// {
// [Fact]
// public void WhenPassedReasonableQuantity_ReturnsNumberReleased()
// {
// var subject = new ParticleBuffer(100);
// var count = subject.Release(50);
// Assert.Equal(count.Total, 50);
// }
// [Fact]
// public void WhenPassedImpossibleQuantity_ReturnsNumberActuallyReleased()
// {
// var subject = new ParticleBuffer(100);
// var count = subject.Release(200);
// Assert.Equal(count.Total, 100);
// }
// }
// public class ReclaimMethod
// {
// [Fact]
// public void WhenPassedReasonableNumber_ReclaimsParticles()
// {
// var subject = new ParticleBuffer(100);
// subject.Release(100);
// Assert.Equal(subject.Count, 100);
// subject.Reclaim(50);
// Assert.Equal(subject.Count, 50);
// }
// }
// //public class CopyToMethod
// //{
// // [Fact]
// // public void WhenBufferIsSequential_CopiesParticlesInOrder()
// // {
// // unsafe
// // {
// // var subject = new ParticleBuffer(10);
// // var iterator = subject.Release(5);
// // do
// // {
// // var particle = iterator.Next();
// // particle->Age = 1f;
// // }
// // while (iterator.HasNext);
// // var destination = new Particle[10];
// // fixed (Particle* buffer = destination)
// // {
// // subject.CopyTo((IntPtr)buffer);
// // }
// // Assert.Equal(destination[0].Age, 1f, 0.0001);
// // Assert.Equal(destination[1].Age, 1f, 0.0001);
// // Assert.Equal(destination[2].Age, 1f, 0.0001);
// // Assert.Equal(destination[3].Age, 1f, 0.0001);
// // Assert.Equal(destination[4].Age, 1f, 0.0001);
// // }
// // }
// //}
// //public class CopyToReverseMethod
// //{
// // [Fact]
// // public void WhenBufferIsSequential_CopiesParticlesInReverseOrder()
// // {
// // unsafe
// // {
// // var subject = new ParticleBuffer(10);
// // var iterator = subject.Release(5);
// // do
// // {
// // var particle = iterator.Next();
// // particle->Age = 1f;
// // }
// // while (iterator.HasNext);
// // var destination = new Particle[10];
// // fixed (Particle* buffer = destination)
// // {
// // subject.CopyToReverse((IntPtr)buffer);
// // }
// // Assert.Equal(destination[0].Age, 1f, 0.0001);
// // Assert.Equal(destination[1].Age, 1f, 0.0001);
// // Assert.Equal(destination[2].Age, 1f, 0.0001);
// // Assert.Equal(destination[3].Age, 1f, 0.0001);
// // Assert.Equal(destination[4].Age, 1f, 0.0001);
// // }
// // }
// //}
// public class DisposeMethod
// {
// [Fact]
// public void IsIdempotent()
// {
// var subject = new ParticleBuffer(100);
// subject.Dispose();
// subject.Dispose();
// }
// }
// }
//}
|