Пример #1
0
        public void TestAddMultiType()
        {
            var vOne = new XYPointMultiType(10, 20, "X");
            var vTwo = new XYPointMultiType(10, 20, "Y");

            vOne.AddMultiType(vTwo);
            AssertValues("X,Y", vOne);
            AssertValues("Y", vTwo);

            var vThree = new XYPointMultiType(10, 20, "1");

            vThree.AddSingleValue("2");
            vOne.AddMultiType(vThree);
            AssertValues("X,Y,1,2", vOne);
            AssertValues("1,2", vThree);

            var vFour = new XYPointMultiType(10, 20, "X");

            vFour.AddSingleValue("1");
            vFour.AddMultiType(vTwo);
            AssertValues("X,1,Y", vFour);

            var vFive = new XYPointMultiType(10, 20, "A");

            vFive.AddSingleValue("B");
            vFive.AddMultiType(vThree);
            AssertValues("A,B,1,2", vFive);
            vFive.AddSingleValue("C");
            AssertValues("A,B,1,2,C", vFive);
        }
Пример #2
0
        public void TestInvalidMerge()
        {
            var vOne = new XYPointMultiType(10, 20, "X");

            try
            {
                vOne.AddMultiType(new XYPointMultiType(5, 20, "Y"));
                Assert.Fail();
            }
            catch (ArgumentException)
            {
                // expected
            }

            try
            {
                vOne.AddMultiType(new XYPointMultiType(10, 19, "Y"));
                Assert.Fail();
            }
            catch (ArgumentException)
            {
                // expected
            }
        }