コード例 #1
0
ファイル: UtilityTest.cs プロジェクト: fossabot/ManagedIrbis2
        public void Utility_MemberwiseEquals_3()
        {
            object first = new MyClass6 {
                X = new MyClass5 {
                    X = 1
                }
            };
            object second = new MyClass6 {
                X = new MyClass5 {
                    X = 1
                }
            };

            Assert.IsTrue(Utility.MemberwiseEquals(first, second));
            Assert.IsTrue(Utility.MemberwiseEquals(second, first));
            Assert.IsTrue(Utility.MemberwiseEquals(first, first));
            Assert.IsTrue(Utility.MemberwiseEquals(second, second));

            second = new MyClass6 {
                X = new MyClass5 {
                    X = 2
                }
            };
            Assert.IsFalse(Utility.MemberwiseEquals(first, second));
            Assert.IsFalse(Utility.MemberwiseEquals(second, first));
        }
コード例 #2
0
        public void Should_use_ToString()
        {
            var settings = new MyClass6
            {
                Str = "asdf"
            };

            var result = PrintAndParse(settings);

            result.Should().Be(@"""!!! asdf""");
        }
コード例 #3
0
    static void Main()
    {
        // Construct a MyClass object by using object initializers.
        MyClass6 obj = new MyClass6
        {
            Count = 100,
            Str   = "Testing"
        };

        Console.WriteLine(obj.Count + " " + obj.Str);
    }