Пример #1
0
        public void UnionOfEightSetValue()
        {
            var union = new Union <int, int, int, int, int, int, double, string>("b");

            AssertThat(union.Type).IsEqualTo(typeof(string));
            AssertThat(union.GetValue()).IsEqualTo("b");
            union.SetValue(1.0);
            AssertThat(union.Type).IsEqualTo(typeof(double));
            AssertThat(union.GetValue()).IsEqualTo(1.0);
        }
Пример #2
0
        public void UnionOfTwoSetValue()
        {
            Union <int, string> union = new Union <int, string>("a");

            AssertThat(union.Type).IsEqualTo(typeof(string));
            AssertThat(union.GetValue()).IsEqualTo("a");
            union.SetValue(123);
            AssertThat(union.Type).IsEqualTo(typeof(int));
            AssertThat(union.GetValue()).IsEqualTo(123);
        }
Пример #3
0
        public void UnionOfTwoGetValueSecond()
        {
            Union <int, string> union = new Union <int, string>("world");

            AssertThat(union.GetValue()).IsEqualTo("world");
        }
Пример #4
0
        public void UnionOfTwoGetValueFirst()
        {
            Union <int, string> union = new Union <int, string>(1337);

            AssertThat(union.GetValue()).IsEqualTo(1337);
        }