Beispiel #1
0
 public void EqualsTest()
 {
     object angle = 10F;
     Angle target = new Angle(10);
     bool expected = true;
     Assert.AreEqual(target.Equals(angle), expected);
 }
Beispiel #2
0
        public void RandomConstructionTest()
        {
            Random random = new Random();
            for(uint i=0; i<10000; i++)
            {
                double decimalAngle = random.Next(-360, 360);
                Angle angle = new Angle(decimalAngle);
                Angle angle2 = new Angle(angle.Degrees,angle.Minutes,angle.Seconds);

                Assert.AreEqual(angle2.Degrees, angle.Degrees);
                Assert.AreEqual(angle2.Minutes, angle.Minutes);
                Assert.AreEqual(angle2.DecimalMinutes, angle.DecimalMinutes);
                Assert.AreEqual(angle2.Seconds, angle.Seconds);
                Assert.AreEqual(angle2.Degrees, angle.DecimalDegrees);

                //Ensure casting is working
                double castedAngle = angle;
                Assert.AreEqual(decimalAngle, castedAngle);

                //Ensure == is working
                Assert.AreEqual(true,angle2 == angle);
                Assert.False(angle2 != angle);
                Assert.True(angle2 == angle);
                Assert.True(angle2.Equals(angle));
            }
        }