RingProfileTests.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using Microsoft.Xna.Framework;
  3. using MonoGame.Extended.Particles.Profiles;
  4. namespace MonoGame.Extended.Tests.Particles.Profiles
  5. {
  6. public class RingProfileTests
  7. {
  8. [Fact]
  9. public unsafe void ReturnsOffsetEqualToRadius()
  10. {
  11. RingProfile subject = new RingProfile
  12. {
  13. Radius = 10f
  14. };
  15. Vector2 offset;
  16. Vector2 heading;
  17. subject.GetOffsetAndHeading(&offset, &heading);
  18. double length = Math.Sqrt(offset.X * offset.X + offset.Y * offset.Y);
  19. Assert.Equal(10.0f, length, precision: 5);
  20. }
  21. [Fact]
  22. public unsafe void WhenRadiateIsTrue_HeadingIsEqualToNormalizedOffset()
  23. {
  24. RingProfile subject = new RingProfile
  25. {
  26. Radius = 10f,
  27. Radiate = CircleRadiation.Out
  28. };
  29. Vector2 offset;
  30. Vector2 heading;
  31. subject.GetOffsetAndHeading(&offset, &heading);
  32. Assert.Equal(heading.X, offset.X / 10, precision: 5);
  33. Assert.Equal(heading.Y, offset.Y / 10, precision: 5);
  34. }
  35. }
  36. }