Beispiel #1
0
    public void TestImplicitCtor()
    {
        Foo foo = new Foo {
            A = 10
        };
        MethodsWithDefaultValues m = foo;

        Assert.AreEqual(foo.A, m.A);
        MethodsWithDefaultValues m1 = 5;

        Assert.AreEqual(5, m1.A);
    }
Beispiel #2
0
 public void TestMultipleInheritance()
 {
     var baz = new Baz();
     Assert.That(baz.Method, Is.EqualTo(1));
     var bar = (IBar) baz;
     Assert.That(bar.Method, Is.EqualTo(2));
     Assert.That(baz[0], Is.EqualTo(50));
     bar[0] = new Foo { A = 1000 };
     Assert.That(bar[0].A, Is.EqualTo(1000));
     Assert.That(baz.FarAwayFunc, Is.EqualTo(20));
     Assert.That(baz.TakesQux(baz), Is.EqualTo(20));
     Assert.That(baz.ReturnQux().FarAwayFunc, Is.EqualTo(20));
 }
Beispiel #3
0
    public void TestIndexer()
    {
        var foo = new Foo();

        Assert.That(foo[0], Is.EqualTo(50));
        foo[0] = 250;
        Assert.That(foo[0], Is.EqualTo(250));

        Assert.That(foo[(uint) 0], Is.EqualTo(15));

        var bar = new Bar();
        Assert.That(bar[0].A, Is.EqualTo(10));
        bar[0] = new Foo { A = 25 };
        Assert.That(bar[0].A, Is.EqualTo(25));
    }
Beispiel #4
0
    public void TestMultipleInheritance()
    {
        var baz = new Baz();

        Assert.That(baz.Method, Is.EqualTo(1));
        var bar = (IBar)baz;

        Assert.That(bar.Method, Is.EqualTo(2));
        Assert.That(baz[0], Is.EqualTo(50));
        bar[0] = new Foo {
            A = 1000
        };
        Assert.That(bar[0].A, Is.EqualTo(1000));
        Assert.That(baz.FarAwayFunc, Is.EqualTo(20));
        Assert.That(baz.TakesQux(baz), Is.EqualTo(20));
        Assert.That(baz.ReturnQux().FarAwayFunc, Is.EqualTo(20));
    }
Beispiel #5
0
    public void TestIndexer()
    {
        var foo = new Foo();

        Assert.That(foo[0], Is.EqualTo(50));
        foo[0] = 250;
        Assert.That(foo[0], Is.EqualTo(250));

        Assert.That(foo[(uint)0], Is.EqualTo(15));

        var bar = new Bar();

        Assert.That(bar[0].A, Is.EqualTo(10));
        bar[0] = new Foo {
            A = 25
        };
        Assert.That(bar[0].A, Is.EqualTo(25));
    }
Beispiel #6
0
 public void TestImplicitCtor()
 {
     Foo foo = new Foo { A = 10 };
     MethodsWithDefaultValues m = foo;
     Assert.AreEqual(foo.A, m.A);
     MethodsWithDefaultValues m1 = 5;
     Assert.AreEqual(5, m1.A);
 }