summaryrefslogtreecommitdiff
path: root/Plugins/MonoGame.Extended/tests/MonoGame.Extended.Tests/Particles/Profiles/RingProfileTests.cs
blob: a18f5b7b75e349f91cf5aac1c40ae9b6843473aa (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
using System;
using MonoGame.Extended.Particles.Profiles;
using Xunit;

namespace MonoGame.Extended.Tests.Particles.Profiles
{
    public class RingProfileTests
    {
        [Fact]
        public void ReturnsOffsetEqualToRadius()
        {
            var subject = new RingProfile
            {
                Radius = 10f
            };
            subject.GetOffsetAndHeading(out var offset, out _);

            var length = Math.Sqrt(offset.X * offset.X + offset.Y * offset.Y);
            Assert.Equal(10f, length, 6);
        }

        [Fact]
        public void WhenRadiateIsTrue_HeadingIsEqualToNormalizedOffset()
        {
            var subject = new RingProfile
            {
                Radius = 10f,
                Radiate = Profile.CircleRadiation.Out
            };
            subject.GetOffsetAndHeading(out var offset, out var heading);

            Assert.Equal(heading.X, offset.X / 10, 6);
            Assert.Equal(heading.Y, offset.Y / 10, 6);

        }

    }
}