예제 #1
0
        public void Equals()
        {
            Pudelko p1 = new Pudelko();
            Pudelko p2 = new Pudelko(10, 25, null, UnitOfMeasure.centimeter);
            Pudelko p3 = new Pudelko(100, null, null, UnitOfMeasure.milimeter);
            Pudelko p4 = new Pudelko(0.1, 0.1, 0.1);
            Pudelko p5 = new Pudelko(1, 2, 8);

            Assert.IsTrue(p1.Equals(p3));
            Assert.IsTrue(p1.Equals(p4));
            Assert.IsTrue(p3.Equals(p4));
            Assert.IsFalse(p1.Equals(p2));
            Assert.IsFalse(p1.Equals(p5));
            Assert.IsFalse(p5.Equals(p2));
        }
        public void Are_not_equals(double a, double b, double c, double d, double e, double f, bool equals)
        {
            var p  = new Pudelko(a, b, c);
            var p1 = new Pudelko(d, e, f);

            Assert.AreEqual(p.Equals(p1), equals);
        }
        public void Are_equals_unit(double a, double b, double c, double d, double e, double f, bool equals)
        {
            var p  = new Pudelko(a, b, c, UnitOfMeasure.centimeter);
            var p1 = new Pudelko(d, e, f, UnitOfMeasure.meter);

            Assert.AreEqual(p.Equals(p1), equals);
        }
예제 #4
0
        public void Equals(double a, double b, double c, UnitOfMeasure unit, double a2, double b2, double c2, UnitOfMeasure unit2, bool isEqual)
        {
            Pudelko p1 = new Pudelko(a, b, c, unit);
            Pudelko p2 = new Pudelko(a2, b2, c2, unit2);

            Assert.AreEqual(p1.Equals(p2), isEqual);
        }
예제 #5
0
        public void Equals_OtherHasSameEdges_ReturnsTrue(double a, double b, double c)
        {
            var p1 = new Pudelko(a, b, c);
            var p2 = new Pudelko(a, b, c);

            Assert.AreEqual(p1.Equals(p2), true);
        }
예제 #6
0
        public void Test_equals(double a1, double b1, double c1, double a2, double b2, double c2, bool expected)
        {
            Pudelko pA = new Pudelko(a1, b1, c1);
            Pudelko pB = new Pudelko(a2, b2, c2);

            Assert.AreEqual(expected, pA.Equals(pB));
        }
예제 #7
0
        public void Equals_OtherIsReferenceToSameObject_ReturnsTrue()
        {
            var p1 = new Pudelko();
            var p2 = p1;

            Assert.AreEqual(p1.Equals(p2), true);
        }
예제 #8
0
        public void Equals(double a, double b, double c, double expectedA, double expectedB, double expectedC, bool expectedResult)
        {
            Pudelko p1 = new Pudelko(a, b, c);
            Pudelko p2 = new Pudelko(expectedA, expectedB, expectedC);

            Assert.AreEqual(expectedResult, p1.Equals(p2));
        }
예제 #9
0
        public void Equals_OtherIsNull_ReturnsFalse()
        {
            var     p1 = new Pudelko();
            Pudelko p2 = null;

            Assert.AreEqual(p1.Equals(p2), false);
        }
예제 #10
0
        public void Equals_test(double a1, double b1, double c1, double a2, double b2, double c2, bool expected)
        {
            Pudelko pudelko1 = new Pudelko(a1, b1, c1);
            Pudelko pudelko2 = new Pudelko(a2, b2, c2);

            Assert.AreEqual(expected, pudelko1.Equals(pudelko2));
        }
        public void Are_Equals_3_Param_Default(double a, double b, double c, bool equals)
        {
            var p  = new Pudelko(a, b, c);
            var p1 = new Pudelko(b, c, a);

            Assert.AreEqual(p.Equals(p1), equals);
        }
예제 #12
0
        public void Equals_GetFalse(double a1, double a2, double b1, double b2, double c1, double c2, bool expectedResult)
        {
            var p1 = new Pudelko(a1, b1, c1);
            var p2 = new Pudelko(a2, b2, c2);

            Assert.AreEqual(expectedResult, p1.Equals(p2));
        }
예제 #13
0
        public void Equals_GetTrue(double a1, double a2, double b1, double b2, double c1, double c2)
        {
            var p1 = new Pudelko(a1, b1, c1);
            var p2 = new Pudelko(a2, b2, c2);

            Assert.IsTrue(p1.Equals(p2));
        }
예제 #14
0
        public void Equals_OtherHasDifferentEdges_ReturnsFalse(double otherA, double otherB, double otherC)
        {
            var p1 = new Pudelko(3.0, 2.1, 5.5);
            var p2 = new Pudelko(otherA, otherB, otherC);


            Assert.AreEqual(p1.Equals(p2), false);
        }
        public void Equals_Meters_And_Milimeters(double a, double b, double c,
                                                 double a2, double b2, double c2, bool expected)
        {
            Pudelko p1 = new Pudelko(a, b, c, unit: UnitOfMeasure.meter);
            Pudelko p2 = new Pudelko(a2, b2, c2, unit: UnitOfMeasure.milimeter);

            Assert.AreEqual(expected, p1.Equals(p2));
        }
        public void AddOperator_Meters_And_Centimeters(double a, double b, double c,
                                                       double a2, double b2, double c2,
                                                       double addedA, double addedB, double addedC
                                                       )
        {
            Pudelko p1 = new Pudelko(a, b, c, unit: UnitOfMeasure.meter);
            Pudelko p2 = new Pudelko(a2, b2, c2, unit: UnitOfMeasure.centimeter);

            Pudelko expected = new Pudelko(addedA, addedB, addedC);


            Assert.AreEqual(true, expected.Equals(p1 + p2));
        }
예제 #17
0
        static void Main()
        {
            Console.WriteLine("Pudelko Marek Woźniak");

            Pudelko p1      = new Pudelko(5, 7, 4);
            Pudelko p2      = new Pudelko(40, 50, 50, UnitOfMeasure.centimeter);
            Pudelko p3      = new Pudelko(100, 300, 500, UnitOfMeasure.centimeter);
            var     pudelka = new Pudelko[] { p3, p2, p1 };

            Console.WriteLine("\nForeach: ");
            foreach (var p in pudelka)
            {
                Console.WriteLine(p);
            }

            Console.WriteLine("\nSort: ");
            Array.Sort(pudelka, Pudelko.CompareBoxes);

            foreach (var p in pudelka)
            {
                Console.WriteLine(p);
            }


            Console.WriteLine("\nNasze p1: " + p1);
            Console.WriteLine("Nasze p2: " + p2);

            Console.WriteLine("\nPole p1: " + p1.Pole);
            Console.WriteLine("Objetosc p2: " + p2.Objetosc);
            Console.WriteLine("\nCzy p1 jest równe p2 :" + p1.Equals(p2));
            Console.WriteLine("GetHashCode p1:" + p1.GetHashCode());
            Console.WriteLine("GetHashCode p2:" + p2.GetHashCode());

            Console.WriteLine("\nPudełko sześcienne o takiej samej objętości, jak p: " + p1.Compress());
            Console.WriteLine("p1[1]: " + p1[1]);
            Console.WriteLine("\nPrzeglądanie długości krawędzi: ");
            foreach (var i in p1)
            {
                Console.WriteLine(i);
            }
            Console.Write("Parse: ");
            Console.WriteLine(new Pudelko(2.5, 9.321, 0.1) == Pudelko.Parse("2.500 m × 9.321 m × 0.100 m"));
        }