EmitterTests.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. //using System;
  2. //using Microsoft.Xna.Framework;
  3. //using MonoGame.Extended.Particles;
  4. //using MonoGame.Extended.Particles.Modifiers;
  5. //using MonoGame.Extended.Particles.Profiles;
  6. //using Xunit;
  7. //namespace MonoGame.Extended.Tests.Particles
  8. //{
  9. //
  10. // public class EmitterTests
  11. // {
  12. // public class UpdateMethod
  13. // {
  14. // [Fact]
  15. // public void WhenThereAreParticlesToExpire_DecreasesActiveParticleCount()
  16. // {
  17. // var subject = new ParticleEmitter(null, 100, TimeSpan.FromSeconds(1), Profile.Point())
  18. // {
  19. // AutoTrigger = false,
  20. // Parameters = new ParticleReleaseParameters
  21. // {
  22. // Quantity = 1
  23. // }
  24. // };
  25. // subject.Trigger(new Vector2(0f, 0f));
  26. // Assert.Equal(subject.ActiveParticles, 1);
  27. // subject.Update(2f);
  28. // Assert.Equal(subject.ActiveParticles, 0);
  29. // }
  30. // [Fact]
  31. // public void WhenThereAreParticlesToExpire_DoesNotPassExpiredParticlesToModifiers()
  32. // {
  33. // var subject = new ParticleEmitter(null, 100, TimeSpan.FromSeconds(1), Profile.Point())
  34. // {
  35. // Parameters = new ParticleReleaseParameters()
  36. // {
  37. // Quantity = 1
  38. // },
  39. // Modifiers =
  40. // {
  41. // new AssertionModifier(particle => particle.Age <= 1f)
  42. // }
  43. // };
  44. // subject.Trigger(new Vector2(0f, 0f));
  45. // subject.Update(0.5f);
  46. // subject.Trigger(new Vector2(0f, 0f));
  47. // subject.Update(0.5f);
  48. // subject.Trigger(new Vector2(0f, 0f));
  49. // subject.Update(0.5f);
  50. // }
  51. // [Fact]
  52. // public void WhenThereAreNoActiveParticles_GracefullyDoesNothing()
  53. // {
  54. // var subject = new ParticleEmitter(null, 100, TimeSpan.FromSeconds(1), Profile.Point()) { AutoTrigger = false };
  55. // subject.Update(0.5f);
  56. // Assert.Equal(subject.ActiveParticles, 0);
  57. // }
  58. // }
  59. // public class TriggerMethod
  60. // {
  61. // [Fact]
  62. // public void WhenEnoughHeadroom_IncreasesActiveParticlesCountByReleaseQuantity()
  63. // {
  64. // var subject = new ParticleEmitter(null, 100, TimeSpan.FromSeconds(1), Profile.Point())
  65. // {
  66. // Parameters = new ParticleReleaseParameters
  67. // {
  68. // Quantity = 10
  69. // }
  70. // };
  71. // Assert.Equal(subject.ActiveParticles, 0);
  72. // subject.Trigger(new Vector2(0f, 0f));
  73. // Assert.Equal(subject.ActiveParticles, 10);
  74. // }
  75. // [Fact]
  76. // public void WhenNotEnoughHeadroom_IncreasesActiveParticlesCountByRemainingParticles()
  77. // {
  78. // var subject = new ParticleEmitter(null, 15, TimeSpan.FromSeconds(1), Profile.Point())
  79. // {
  80. // Parameters = new ParticleReleaseParameters
  81. // {
  82. // Quantity = 10
  83. // }
  84. // };
  85. // subject.Trigger(new Vector2(0f, 0f));
  86. // Assert.Equal(subject.ActiveParticles, 10);
  87. // subject.Trigger(new Vector2(0f, 0f));
  88. // Assert.Equal(subject.ActiveParticles, 15);
  89. // }
  90. // [Fact]
  91. // public void WhenNoRemainingParticles_DoesNotIncreaseActiveParticlesCount()
  92. // {
  93. // var subject = new ParticleEmitter(null, 10, TimeSpan.FromSeconds(1), Profile.Point())
  94. // {
  95. // Parameters = new ParticleReleaseParameters
  96. // {
  97. // Quantity = 10
  98. // }
  99. // };
  100. // subject.Trigger(new Vector2(0f, 0f));
  101. // Assert.Equal(subject.ActiveParticles, 10);
  102. // subject.Trigger(new Vector2(0f, 0f));
  103. // Assert.Equal(subject.ActiveParticles, 10);
  104. // }
  105. // }
  106. // public class DisposeMethod
  107. // {
  108. // [Fact]
  109. // public void IsIdempotent()
  110. // {
  111. // var subject = new ParticleEmitter(null, 10, TimeSpan.FromSeconds(1), Profile.Point());
  112. // subject.Dispose();
  113. // subject.Dispose();
  114. // }
  115. // }
  116. // }
  117. //}