예제 #1
0
    public void Test_IEquatable()
    {
      Percentage first = new Percentage(50.0);
      Percentage second = new Percentage(50);

      Assert.IsTrue(first == second);
      Assert.IsTrue(first.Equals(second));
      Assert.IsTrue(first.Equals((object)second));
    }
예제 #2
0
        public void Test_IEquatable()
        {
            Percentage first  = new Percentage(50.0);
            Percentage second = new Percentage(50);

            Assert.IsTrue(first == second);
            Assert.IsTrue(first.Equals(second));
            Assert.IsTrue(first.Equals((object)second));
        }
예제 #3
0
        public void Create_A_Percentage_From_Different_Types_Is_The_Same()
        {
            var itg = new Percentage(5);
            var dbl = new Percentage(5.0);
            var dcm = new Percentage(5m);

            itg.Equals(dbl).Should().BeTrue();
            itg.Equals(dcm).Should().BeTrue();
            dbl.Equals(dcm).Should().BeTrue();
        }
예제 #4
0
        public void Should_compare_with_null_instance(double value)
        {
            var instance = new Percentage(value);

            Assert.IsFalse(instance.Equals(null), "Equals");
            Assert.AreEqual(1, instance.CompareTo(null), "CompareTo");
        }
예제 #5
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is OrderLineItemDiscount other &&
                   ((Uid == null && other.Uid == null) || (Uid?.Equals(other.Uid) == true)) &&
                   ((CatalogObjectId == null && other.CatalogObjectId == null) || (CatalogObjectId?.Equals(other.CatalogObjectId) == true)) &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) &&
                   ((Percentage == null && other.Percentage == null) || (Percentage?.Equals(other.Percentage) == true)) &&
                   ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) &&
                   ((AppliedMoney == null && other.AppliedMoney == null) || (AppliedMoney?.Equals(other.AppliedMoney) == true)) &&
                   ((Metadata == null && other.Metadata == null) || (Metadata?.Equals(other.Metadata) == true)) &&
                   ((Scope == null && other.Scope == null) || (Scope?.Equals(other.Scope) == true)) &&
                   ((RewardIds == null && other.RewardIds == null) || (RewardIds?.Equals(other.RewardIds) == true)) &&
                   ((PricingRuleId == null && other.PricingRuleId == null) || (PricingRuleId?.Equals(other.PricingRuleId) == true)));
        }
예제 #6
0
            public void ShouldReturnTrueWhenInstanceIsEqual()
            {
                var first  = new Percentage(50.0);
                var second = new Percentage(50.0);

                Assert.IsTrue(first.Equals(second));
            }
예제 #7
0
            public void ShouldReturnTrueWhenObjectIsEqual()
            {
                var first  = new Percentage(50.0);
                var second = new Percentage(50.0);

                Assert.IsTrue(first.Equals((object)second));
            }
예제 #8
0
            public void ShouldReturnFalseWhenInstanceIsNotEqual()
            {
                var first  = new Percentage(50.0);
                var second = new Percentage(50.1);

                Assert.IsFalse(first.Equals(second));
            }
예제 #9
0
            public void ShouldReturnFalseWhenObjectIsNotEqual()
            {
                var first  = new Percentage(50.0);
                var second = new Percentage(50.1);

                Assert.IsFalse(first.Equals((object)second));
            }
예제 #10
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is OrderReturnServiceCharge other &&
                   ((Uid == null && other.Uid == null) || (Uid?.Equals(other.Uid) == true)) &&
                   ((SourceServiceChargeUid == null && other.SourceServiceChargeUid == null) || (SourceServiceChargeUid?.Equals(other.SourceServiceChargeUid) == true)) &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((CatalogObjectId == null && other.CatalogObjectId == null) || (CatalogObjectId?.Equals(other.CatalogObjectId) == true)) &&
                   ((Percentage == null && other.Percentage == null) || (Percentage?.Equals(other.Percentage) == true)) &&
                   ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) &&
                   ((AppliedMoney == null && other.AppliedMoney == null) || (AppliedMoney?.Equals(other.AppliedMoney) == true)) &&
                   ((TotalMoney == null && other.TotalMoney == null) || (TotalMoney?.Equals(other.TotalMoney) == true)) &&
                   ((TotalTaxMoney == null && other.TotalTaxMoney == null) || (TotalTaxMoney?.Equals(other.TotalTaxMoney) == true)) &&
                   ((CalculationPhase == null && other.CalculationPhase == null) || (CalculationPhase?.Equals(other.CalculationPhase) == true)) &&
                   ((Taxable == null && other.Taxable == null) || (Taxable?.Equals(other.Taxable) == true)) &&
                   ((AppliedTaxes == null && other.AppliedTaxes == null) || (AppliedTaxes?.Equals(other.AppliedTaxes) == true)));
        }
예제 #11
0
        public void Should_compare_with_another_type_of_instance(double value)
        {
            var    instance1 = new Percentage(value);
            object instance2 = value;

            Assert.IsFalse(instance1.Equals(instance2), "Equals");
            Assert.Throws <ArgumentException>(() => instance1.CompareTo(instance2), "CompareTo");
        }
예제 #12
0
        public void Equals_Works_As_Expected()
        {
            var one   = new Percentage(5.0);
            var other = Percentage.FromFraction(0.05);

            one.Equals(other).Should().BeTrue();
            (one == other).Should().BeTrue();
        }
예제 #13
0
 public bool Equals(MeltJob pJob)
 {
     return
         (pJob != null &&
          Percentage.Equals(pJob.Percentage) &&
          Status.Equals(pJob.Status) &&
          TimeTaken.Equals(pJob.TimeTaken));
 }
예제 #14
0
        public void Should_compare_with_smaller_value(double baseValue, double smallerValue)
        {
            var baseInstance    = new Percentage(baseValue);
            var smallerInstance = new Percentage(smallerValue);

            Assert.IsFalse(baseInstance.Equals(smallerInstance), "Equals");
            Assert.IsFalse(baseInstance.Equals((object)smallerInstance), "Equals object");

            Assert.IsFalse(baseInstance == smallerInstance, "==");
            Assert.IsTrue(baseInstance != smallerInstance, "!=");

            Assert.AreEqual(+1, baseInstance.CompareTo(smallerInstance), "CompareTo");
            Assert.AreEqual(+1, baseInstance.CompareTo((object)smallerInstance), "CompareTo object");

            Assert.IsFalse(baseInstance < smallerInstance, "<");
            Assert.IsTrue(baseInstance > smallerInstance, ">");

            Assert.IsFalse(baseInstance <= smallerInstance, "<=");
            Assert.IsTrue(baseInstance >= smallerInstance, ">=");
        }
예제 #15
0
        public void Should_compare_with_same_value(double value)
        {
            var baseInstance  = new Percentage(value);
            var otherInstance = new Percentage(value);

            Assert.IsTrue(baseInstance.Equals(otherInstance), "Equals");
            Assert.IsTrue(baseInstance.Equals((object)otherInstance), "Equals object");

            Assert.IsTrue(baseInstance == otherInstance, "==");
            Assert.IsFalse(baseInstance != otherInstance, "!=");

            Assert.AreEqual(0, baseInstance.CompareTo(otherInstance), "CompareTo");
            Assert.AreEqual(0, baseInstance.CompareTo((object)otherInstance), "CompareTo object");

            Assert.IsFalse(baseInstance < otherInstance, "<");
            Assert.IsFalse(baseInstance > otherInstance, ">");

            Assert.IsTrue(baseInstance <= otherInstance, "<=");
            Assert.IsTrue(baseInstance >= otherInstance, ">=");
        }
예제 #16
0
        public void Should_compare_with_bigger_value(double baseValue, double biggerValue)
        {
            var baseInstance   = new Percentage(baseValue);
            var biggerInstance = new Percentage(biggerValue);

            Assert.IsFalse(baseInstance.Equals(biggerInstance), "Equals");
            Assert.IsFalse(baseInstance.Equals((object)biggerInstance), "Equals object");

            Assert.IsFalse(baseInstance == biggerInstance, "==");
            Assert.IsTrue(baseInstance != biggerInstance, "!=");

            Assert.AreEqual(-1, baseInstance.CompareTo(biggerInstance), "CompareTo");
            Assert.AreEqual(-1, baseInstance.CompareTo((object)biggerInstance), "CompareTo object");

            Assert.IsTrue(baseInstance < biggerInstance, "<");
            Assert.IsFalse(baseInstance > biggerInstance, ">");

            Assert.IsTrue(baseInstance <= biggerInstance, "<=");
            Assert.IsFalse(baseInstance >= biggerInstance, ">=");
        }
예제 #17
0
        public void Percentage_EqualPercentageObjectsShouldReturnEqualityTrue()
        {
            //arrange
            const decimal percentageValue               = 5m;
            const decimal fractionalPercentageValue     = 15.578m;
            var           wholePercentageUnderTest      = new Percentage(percentageValue);
            var           fractionalPercentageUnderTest = new Percentage(fractionalPercentageValue);

            //act & assert
            var expectedWholePercentage = new Percentage(percentageValue);

            Assert.IsTrue(wholePercentageUnderTest.Equals(expectedWholePercentage));
            var expectedFractionalPercentage = new Percentage(fractionalPercentageValue);

            Assert.IsTrue(fractionalPercentageUnderTest.Equals(expectedFractionalPercentage));
        }
예제 #18
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CatalogTax other &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((CalculationPhase == null && other.CalculationPhase == null) || (CalculationPhase?.Equals(other.CalculationPhase) == true)) &&
                   ((InclusionType == null && other.InclusionType == null) || (InclusionType?.Equals(other.InclusionType) == true)) &&
                   ((Percentage == null && other.Percentage == null) || (Percentage?.Equals(other.Percentage) == true)) &&
                   ((AppliesToCustomAmounts == null && other.AppliesToCustomAmounts == null) || (AppliesToCustomAmounts?.Equals(other.AppliesToCustomAmounts) == true)) &&
                   ((Enabled == null && other.Enabled == null) || (Enabled?.Equals(other.Enabled) == true)));
        }
예제 #19
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CatalogDiscount other &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((DiscountType == null && other.DiscountType == null) || (DiscountType?.Equals(other.DiscountType) == true)) &&
                   ((Percentage == null && other.Percentage == null) || (Percentage?.Equals(other.Percentage) == true)) &&
                   ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) &&
                   ((PinRequired == null && other.PinRequired == null) || (PinRequired?.Equals(other.PinRequired) == true)) &&
                   ((LabelColor == null && other.LabelColor == null) || (LabelColor?.Equals(other.LabelColor) == true)) &&
                   ((ModifyTaxBasis == null && other.ModifyTaxBasis == null) || (ModifyTaxBasis?.Equals(other.ModifyTaxBasis) == true)));
        }
예제 #20
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is OrderReturnTax other &&
                   ((Uid == null && other.Uid == null) || (Uid?.Equals(other.Uid) == true)) &&
                   ((SourceTaxUid == null && other.SourceTaxUid == null) || (SourceTaxUid?.Equals(other.SourceTaxUid) == true)) &&
                   ((CatalogObjectId == null && other.CatalogObjectId == null) || (CatalogObjectId?.Equals(other.CatalogObjectId) == true)) &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)) &&
                   ((Percentage == null && other.Percentage == null) || (Percentage?.Equals(other.Percentage) == true)) &&
                   ((AppliedMoney == null && other.AppliedMoney == null) || (AppliedMoney?.Equals(other.AppliedMoney) == true)) &&
                   ((Scope == null && other.Scope == null) || (Scope?.Equals(other.Scope) == true)));
        }
예제 #21
0
 public void Equals_TestStructTestStruct_IsTrue()
 {
     Assert.IsTrue(TestStruct.Equals(TestStruct));
 }
예제 #22
0
        public static void TestMathInConsole()
        {
            float  fTest1;
            float  fTest2;
            double dTest1;
            double dTest2;
            int    iTest1;
            int    iTest2;
            ulong  ulTest1;
            ulong  ulTest2;
            string sTest1;

            byte[] byarrTest1 = new byte[] { 1, 2, 3, 4 };
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("RetroEngineTests.TestMathInConsole");
            Console.WriteLine();
            Console.WriteLine("FastString class:");
            FastString fstrTest1 = new FastString("be", 10);

            Console.WriteLine("fstrTest1=new FastString(\"be\",10):" + fstrTest1.ToString());
            Console.WriteLine("fstrTest1.Length:" + fstrTest1.Length.ToString());
            fstrTest1.Insert(1, "cfd");
            Console.WriteLine("fstrTest1.Insert(1,\"cfd\"):" + fstrTest1.ToString());
            fstrTest1.Remove(2, 1);
            Console.WriteLine("fstrTest1.Remove(2,1):" + fstrTest1.ToString());
            fstrTest1.Append('f');
            Console.WriteLine("fstrTest1.Append('f'):" + fstrTest1.ToString());
            fstrTest1.Append("gh");
            Console.WriteLine("fstrTest1.Append(\"gh\"):" + fstrTest1.ToString());
            Console.WriteLine("fstrTest1.Length:" + fstrTest1.Length.ToString());
            fstrTest1.Insert(fstrTest1.Length, "ij");
            Console.WriteLine("fstrTest1.Insert(fstrTest1.Length,\"ij\"):" + fstrTest1.ToString());
            fstrTest1.Insert(0, "ab");
            Console.WriteLine("fstrTest1.Insert(0,\"ab\"):" + fstrTest1.ToString());
            fstrTest1.Remove(1, 1);
            Console.WriteLine("fstrTest1.Remove(1,1):" + fstrTest1.ToString());
            fstrTest1.Insert(0, '-');
            Console.WriteLine("fstrTest1.Insert(0,'-'):" + fstrTest1.ToString());
            Console.WriteLine();
            Console.WriteLine("Percentage struct:");
            Console.WriteLine("Percentage.ToWholeDivisor:" + Percentage.ToWholeDivisor.ToString());
            Console.WriteLine("Percentage.Entire:" + Percentage.Entire.ToString());
            Percentage percTest1 = new Percentage();

            percTest1.Set_1As100Percent(.5d);
            Console.WriteLine("percTest1.Set_1As100Percent(val=.50):" + percTest1.ToString());
            percTest1.Set(50.0d);
            Console.WriteLine("percTest1.Set(val=50):" + percTest1.ToString());
            Console.WriteLine("percTest1.Multiply(val=800):" + percTest1.Multiply(800).ToString());
            Percentage percTest2 = new Percentage();

            percTest2.From(ref percTest1);
            Console.WriteLine("percTest2.From(val=percTest1):" + percTest2.ToString());
            Console.WriteLine("percTest2.ToString():" + percTest2.ToString());
            Console.WriteLine("percTest2.Equals(val=percTest1):" + ToString(percTest2.Equals(percTest1)));
            percTest2.Set_1As100Percent(1.0234);
            Console.WriteLine("percTest2.Set_1As100Percent(1.0234)" + percTest2.ToString());
            Console.WriteLine("percTest2.ToString():" + percTest2.ToString());
            Console.WriteLine("percTest2.ToString(iDecimalPlaces=-1):" + percTest2.ToString(-1));
            Console.WriteLine("percTest2.ToString(iDecimalPlaces=0):" + percTest2.ToString(0));
            Console.WriteLine("percTest2.ToString(iDecimalPlaces=1):" + percTest2.ToString(1));
            Console.WriteLine("percTest2.ToString(iDecimalPlaces=2):" + percTest2.ToString(2));
            Console.WriteLine("percTest2.ToString(iDecimalPlaces=3):" + percTest2.ToString(3));
            percTest1.Set("100.2");
            Console.WriteLine("percTest1.Set(string val=\"100.2\"):" + percTest1.ToString(2));
            percTest1.Set("10000");
            Console.WriteLine("percTest1.Set(string val=\"10000\"):" + percTest1.ToString(2));
            percTest1.Set(".1%");
            Console.WriteLine("percTest1.Set(string val=\".1%\"):" + percTest1.ToString(2));
            percTest1.Set("10.1%");
            Console.WriteLine("percTest1.Set(string val=\"10.1%\"):" + percTest1.ToString(2));
            percTest1.Set("101%");
            Console.WriteLine("percTest1.Set(string val=\"101%\"):" + percTest1.ToString(2));
            Console.WriteLine();
            Console.WriteLine("Base class static methods:");
            Console.WriteLine("SafeDivideRound(val=1,valDivisor=0,valMax=100):" + SafeDivideRound(1, 0, 100).ToString());
            Console.WriteLine("SafeDivideRound(val=2,valDivisor=0,valMax=100):" + SafeDivideRound(2, 0, 100).ToString());
            Console.WriteLine("SafeDivideRound(val=1,valDivisor=0,valMax=200):" + SafeDivideRound(1, 0, 200).ToString());
            Console.WriteLine("SafeDivideRound(val=-2,valDivisor=0,valMax=100):" + SafeDivideRound(-2, 0, 100).ToString());
            Console.WriteLine("SafeDivideRound(val=-1,valDivisor=0,valMax=200):" + SafeDivideRound(-1, 0, 200).ToString());
            Console.WriteLine("SafeDivideRound(val=100,valDivisor=2,valMax=200):" + SafeDivideRound(100, 2, 200).ToString());
            Console.WriteLine("SafeDivideRound(val=2,valDivisor=3,valMax=200):" + SafeDivideRound(2, 3, 200).ToString());
            Console.WriteLine("SafeDivideRound(val=1,valDivisor=3,valMax=200):" + SafeDivideRound(1, 3, 200).ToString());
            Console.WriteLine("SafeDivideRound(val=100,valDivisor=3,valMax=200):" + SafeDivideRound(100, 3, 200).ToString());
            Console.WriteLine("SafeDivideRound(val=200,valDivisor=300,valMax=200):" + SafeDivideRound(200, 300, 200).ToString());
            Console.WriteLine("SafeDivideRound(val=200,valDivisor=3,valMax=200):" + SafeDivideRound(200, 3, 200).ToString());
            Console.WriteLine();
            iTest1 = int.MinValue;
            Console.WriteLine("iTest1=int.MinValue:" + iTest1.ToString());
            CropAbsoluteValueToPosMax(ref iTest1);
            Console.WriteLine("CropAbsoluteValueToPosMax(ref val=iTest1):" + iTest1.ToString());
            dTest1 = double.MinValue;
            Console.WriteLine("dTest1=double.MinValue:" + dTest1.ToString());
            CropAbsoluteValueToPosMax(ref dTest1);
            Console.WriteLine("CropAbsoluteValueToPosMax(ref val=dTest1):" + dTest1.ToString());
            Console.WriteLine("SafeAdd(dTest,dTest):" + SafeAdd(dTest1, dTest1).ToString());
            Console.WriteLine("SafeAdd(-1*(dTest),-1*dTest):" + SafeAdd(-1 * dTest1, -1 * dTest1).ToString());
            Console.WriteLine("SafeAdd(1f,1f):" + SafeAdd(1F, 1F).ToString());
            Console.WriteLine("SafeAdd(-1f,-1f):" + SafeAdd(-1F, -1F).ToString());
            Console.WriteLine("SafeAdd(1f,-1f):" + SafeAdd(1F, -1F).ToString());
            Console.WriteLine("SafeAdd(-1f,1f):" + SafeAdd(-1F, 1F).ToString());
            Console.WriteLine("SafeAdd(1d,1d):" + SafeAdd(1D, 1D).ToString());
            Console.WriteLine("SafeAdd(-1d,-1d):" + SafeAdd(-1D, -1D).ToString());
            Console.WriteLine("SafeAdd(1d,-1d):" + SafeAdd(1D, -1D).ToString());
            Console.WriteLine("SafeAdd(-1d,1d):" + SafeAdd(-1D, 1D).ToString());
            Console.WriteLine("SafeAdd((int)1,(int)1):" + SafeAdd((int)1, (int)1).ToString());
            Console.WriteLine("SafeAdd((int)-1,(int)-1):" + SafeAdd((int)-1, (int)-1).ToString());
            Console.WriteLine("SafeAdd((int)1,(int)-1):" + SafeAdd((int)1, (int)-1).ToString());
            Console.WriteLine("SafeAdd((int)-1,(int)1):" + SafeAdd((int)-1, (int)1).ToString());
            Console.WriteLine();
            Console.WriteLine("SafeSubtract((ulong)1,(ulong)2):" + SafeSubtract((ulong)1, (ulong)2).ToString());
            Console.WriteLine("SafeSubtract((ulong)2,(ulong)1):" + SafeSubtract((ulong)2, (ulong)1).ToString());
            ulTest1 = ulong.MaxValue - 1;
            ulTest2 = 2;
            Console.WriteLine("ulong.MaxValue:" + ulong.MaxValue.ToString());
            Console.WriteLine("SafeAdd((ulong)" + ulTest1.ToString() + ",(ulong)" + ulTest2.ToString() + "):" + SafeAdd(ulTest1, ulTest2).ToString());
            ulTest2 = 1;
            Console.WriteLine("SafeAdd((ulong)" + ulTest1.ToString() + ",(ulong)" + ulTest2.ToString() + "):" + SafeAdd(ulTest1, ulTest2).ToString());
            Console.WriteLine();
            Console.WriteLine("SafeSubtract(1,1):" + SafeSubtract(1, 1).ToString());
            Console.WriteLine("SafeSubtract(-1,-1):" + SafeSubtract(-1, -1).ToString());
            Console.WriteLine("SafeSubtract(1,-1):" + SafeSubtract(1, -1).ToString());
            Console.WriteLine("SafeSubtract(-1,1):" + SafeSubtract(-1, 1).ToString());
            Console.WriteLine();
            Console.WriteLine("byte SafeAdd(253,2):" + SafeAdd((byte)253, (byte)2).ToString());
            Console.WriteLine("byte SafeAdd(254,2):" + SafeAdd((byte)254, (byte)2).ToString());
            Console.WriteLine("byte SafeSubtract(2,2):" + SafeSubtract((byte)2, (byte)2).ToString());
            Console.WriteLine("byte SafeSubtract(1,2):" + SafeSubtract((byte)1, (byte)2).ToString());
            Console.WriteLine();
            Console.WriteLine("byte SafeAddWrapped(253,2):" + SafeAddWrapped((byte)253, (byte)2).ToString());
            Console.WriteLine("byte SafeAddWrapped(254,2):" + SafeAddWrapped((byte)254, (byte)2).ToString());
            Console.WriteLine("byte SafeSubtractWrapped(2,2):" + SafeSubtractWrapped((byte)2, (byte)2).ToString());
            Console.WriteLine("byte SafeSubtractWrapped(1,2):" + SafeSubtractWrapped((byte)1, (byte)2).ToString());
            Console.WriteLine();
            Console.WriteLine("SafeSqrt(9):" + SafeSqrt(9).ToString());
            Console.WriteLine("SafeSqrt(13):" + SafeSqrt(13).ToString());
            Console.WriteLine("SafeSqrt(19):" + SafeSqrt(19).ToString());
            Console.WriteLine("SafeSqrt(-9):" + SafeSqrt(-9).ToString());
            Console.WriteLine("SafeSqrt(-13):" + SafeSqrt(-13).ToString());
            Console.WriteLine("SafeSqrt(-19):" + SafeSqrt(-19).ToString());
            Console.WriteLine();
            Console.WriteLine("FractionPartOf(2.22222f):" + FractionPartOf(2.22222f).ToString());
            Console.WriteLine("FractionPartOf(2.22222d):" + FractionPartOf(2.22222d).ToString());
            Console.WriteLine("FractionPartOf(1.23f):" + FractionPartOf(1.23f).ToString());
            Console.WriteLine("FractionPartOf(1.23d):" + FractionPartOf(1.23d).ToString());
            fTest1 = 1.23f;
            dTest1 = 1.23d;
            Floor(ref fTest1);
            Floor(ref dTest1);
            Console.WriteLine("Floor(1.93f):" + fTest1.ToString());
            Console.WriteLine("Floor(1.93d):" + dTest1.ToString());
            //Console.WriteLine("IFloor(1.93f):"+IFloor(1.93f).ToString());
            //Console.WriteLine("IFloor(1.93d):"+IFloor(1.93d).ToString());
            fTest1 = 1.23f;
            dTest1 = 1.23d;
            iTest1 = ICeiling(fTest1);
            iTest2 = ICeiling(dTest1);
            Console.WriteLine("ICeiling(1.23f):" + iTest1.ToString());
            Console.WriteLine("ICeiling(1.23d):" + iTest2.ToString());
            Console.WriteLine();
            Console.WriteLine("byarrTest1:" + ToString(byarrTest1));
            Console.WriteLine("SubArray(byarrTest1,0,-1):" + ToString(SubArray(byarrTest1, 0, -1)));
            Console.WriteLine("SubArray(byarrTest1,0,0):" + ToString(SubArray(byarrTest1, 0, 0)));
            Console.WriteLine("SubArray(byarrTest1,0,1):" + ToString(SubArray(byarrTest1, 0, 1)));
            Console.WriteLine("SubArray(byarrTest1,0,2):" + ToString(SubArray(byarrTest1, 0, 2)));
            Console.WriteLine("SubArray(byarrTest1,1,2):" + ToString(SubArray(byarrTest1, 1, 2)));
            Console.WriteLine("SubArray(byarrTest1,2,2):" + ToString(SubArray(byarrTest1, 2, 2)));
            Console.WriteLine("SubArray(byarrTest1,3,2):" + ToString(SubArray(byarrTest1, 3, 2)));
            Console.WriteLine("SubArray(byarrTest1,0,3):" + ToString(SubArray(byarrTest1, 0, 3)));
            Console.WriteLine("SubArray(byarrTest1,1,3):" + ToString(SubArray(byarrTest1, 1, 3)));
            Console.WriteLine("SubArray(byarrTest1,-1,4):" + ToString(SubArray(byarrTest1, -1, 4)));
            Console.WriteLine();
            Console.WriteLine("SubArrayReversed(byarrTest1,0,-1):" + ToString(SubArrayReversed(byarrTest1, 0, -1)));
            Console.WriteLine("SubArrayReversed(byarrTest1,0,0):" + ToString(SubArrayReversed(byarrTest1, 0, 0)));
            Console.WriteLine("SubArrayReversed(byarrTest1,0,1):" + ToString(SubArrayReversed(byarrTest1, 0, 1)));
            Console.WriteLine("SubArrayReversed(byarrTest1,0,2):" + ToString(SubArrayReversed(byarrTest1, 0, 2)));
            Console.WriteLine("SubArrayReversed(byarrTest1,1,2):" + ToString(SubArrayReversed(byarrTest1, 1, 2)));
            Console.WriteLine("SubArrayReversed(byarrTest1,2,2):" + ToString(SubArrayReversed(byarrTest1, 2, 2)));
            Console.WriteLine("SubArrayReversed(byarrTest1,3,2):" + ToString(SubArrayReversed(byarrTest1, 3, 2)));
            Console.WriteLine("SubArrayReversed(byarrTest1,0,3):" + ToString(SubArrayReversed(byarrTest1, 0, 3)));
            Console.WriteLine("SubArrayReversed(byarrTest1,1,3):" + ToString(SubArrayReversed(byarrTest1, 1, 3)));
            Console.WriteLine("SubArrayReversed(byarrTest1,0,4):" + ToString(SubArrayReversed(byarrTest1, 0, 4)));
            Console.WriteLine("SubArrayReversed(byarrTest1,-1,4):" + ToString(SubArrayReversed(byarrTest1, -1, 4)));
            Console.WriteLint("ToByte(257):" + RConvert.ToByte((int)257).ToString());
            Console.WriteLint("ToByte(-2):" + RConvert.ToByte((int)-1).ToString());
            Console.WriteLint("ToByte(257.0d):" + RConvert.ToByte(257.0d).ToString());
            Console.WriteLint("ToByte(-2.0d):" + RConvert.ToByte(-2.0d).ToString());
            Console.WriteLint("ToByte(2.4d):" + RConvert.ToByte(2.4d).ToString());
            Console.WriteLint("ToByte(2.5d):" + RConvert.ToByte(2.5d).ToString());
            Console.WriteLint("ToByte(2.4f):" + RConvert.ToByte(2.4f).ToString());
            Console.WriteLint("ToByte(2.5f):" + RConvert.ToByte(2.5f).ToString());
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            //SubArrayReversed(ref byarrTest1
        } //end TestMathInConsole
예제 #23
0
            public void ShouldReturnTrueWhenObjectIsTheSame()
            {
                Percentage percentage = default;

                Assert.IsTrue(percentage.Equals((object)percentage));
            }
예제 #24
0
            public void ShouldReturnTrueWhenInstanceIsTheSame()
            {
                Percentage percentage = default;

                Assert.IsTrue(percentage.Equals(percentage));
            }
예제 #25
0
            public void ShouldReturnFalseWhenInstanceIsNull()
            {
                Percentage percentage = default;

                Assert.IsFalse(percentage.Equals(null));
            }