예제 #1
0
    public void TestCodeGeneration()
    {
#pragma warning disable 0168 // warning CS0168: The variable `foo' is declared but never used
#pragma warning disable 0219 // warning CS0219: The variable `foo' is assigned but its value is never used

        using (var changedAccessOfInheritedProperty = new ChangedAccessOfInheritedProperty())
        {
            Assert.That(changedAccessOfInheritedProperty.Property, Is.EqualTo(2));
        }
        Foo.NestedAbstract a;
        var renamedEmptyEnum = Foo.RenamedEmptyEnum.EmptyEnum1;
        using (var foo = new Foo())
        {
            Bar bar = foo;
            Assert.IsTrue(Bar.Item.Item1 == bar);
        }
        using (var overridesNonDirectVirtual = new OverridesNonDirectVirtual())
        {
            using (var foo = new Foo())
            {
                Assert.That(overridesNonDirectVirtual.RetInt(foo), Is.EqualTo(3));
            }
        }
        using (var derivedFromTemplateInstantiationWithVirtual = new DerivedFromTemplateInstantiationWithVirtual())
        {
        }
        using (var hasProtectedEnum = new HasProtectedEnum())
        {
        }

#pragma warning restore 0168
#pragma warning restore 0219
    }
예제 #2
0
    public void TestCodeGeneration()
    {
        Assert.That(new ChangedAccessOfInheritedProperty().Property, Is.EqualTo(2));
        Foo.NestedAbstract a;
        var renamedEmptyEnum = Foo.RenamedEmptyEnum.EmptyEnum1;

        using (var foo = new Foo())
        {
            Bar bar = foo;
            Assert.IsTrue(Bar.Item.Item1 == bar);
        }
        using (var overridesNonDirectVirtual = new OverridesNonDirectVirtual())
        {
            using (var foo = new Foo())
            {
                Assert.That(overridesNonDirectVirtual.retInt(foo), Is.EqualTo(3));
            }
        }
        using (var derivedFromTemplateInstantiationWithVirtual = new DerivedFromTemplateInstantiationWithVirtual())
        {
        }
        using (var hasProtectedEnum = new HasProtectedEnum())
        {
        }
    }
예제 #3
0
    public unsafe void TestCodeGeneration()
    {
#pragma warning disable 0168 // warning CS0168: The variable `foo' is declared but never used
#pragma warning disable 0219 // warning CS0219: The variable `foo' is assigned but its value is never used

        using (var changedAccessOfInheritedProperty = new ChangedAccessOfInheritedProperty())
        {
            Assert.That(changedAccessOfInheritedProperty.Property, Is.EqualTo(2));
        }
        Foo.NestedAbstract a;
        var renamedEmptyEnum = Foo.RenamedEmptyEnum.EmptyEnum1;
        using (var foo = new Foo())
        {
            Bar bar = foo;
            Assert.IsTrue(Bar.Item.Item1 == bar);

            using (var hasOverloadsWithDifferentPointerKindsToSameType =
                       new HasOverloadsWithDifferentPointerKindsToSameType())
            {
                hasOverloadsWithDifferentPointerKindsToSameType.Overload(foo, 0);
                using (var foo2 = new Foo2())
                    hasOverloadsWithDifferentPointerKindsToSameType.Overload(foo2, 0);
            }
        }
        using (var overridesNonDirectVirtual = new OverridesNonDirectVirtual())
        {
            using (var foo = new Foo())
            {
                Assert.That(overridesNonDirectVirtual.RetInt(foo), Is.EqualTo(3));
                Assert.That(foo.FooPtr, Is.EqualTo(1));
            }
        }
        using (var derivedFromTemplateInstantiationWithVirtual = new DerivedFromTemplateInstantiationWithVirtual())
        {
        }
        using (var hasProtectedEnum = new HasProtectedEnum())
        {
        }
        EnumWithUnderscores e = EnumWithUnderscores.lOWER_BEFORE_CAPITAL;
        e = EnumWithUnderscores.UnderscoreAtEnd;
        e = EnumWithUnderscores.CAPITALS_More;
        e = EnumWithUnderscores.UsesDigits1_0;
        e.GetHashCode();
        ItemsDifferByCase itemsDifferByCase = ItemsDifferByCase.Case_a;
        itemsDifferByCase = ItemsDifferByCase.CaseA;
        itemsDifferByCase.GetHashCode();
        new AmbiguousParamNames(0, 0).Dispose();
        Common.SMallFollowedByCapital();
        Common.IntegerOverload(0);
        Common.IntegerOverload((uint)0);
        Common.TakeVoidStarStar(null);
        Common.OverloadPointer(IntPtr.Zero, 1);
        using (new DerivedFromSecondaryBaseWithIgnoredVirtualMethod()) { }

#pragma warning restore 0168
#pragma warning restore 0219
    }
예제 #4
0
    public void TestCodeGeneration()
    {
#pragma warning disable 0168 // warning CS0168: The variable `foo' is declared but never used
#pragma warning disable 0219 // warning CS0219: The variable `foo' is assigned but its value is never used

        using (var changedAccessOfInheritedProperty = new ChangedAccessOfInheritedProperty())
        {
            Assert.That(changedAccessOfInheritedProperty.Property, Is.EqualTo(2));
        }
        Foo.NestedAbstract a;
        var renamedEmptyEnum = Foo.RenamedEmptyEnum.EmptyEnum1;
        using (var foo = new Foo())
        {
            Bar bar = foo;
            Assert.IsTrue(Bar.Item.Item1 == bar);
        }
        using (var overridesNonDirectVirtual = new OverridesNonDirectVirtual())
        {
            using (var foo = new Foo())
            {
                Assert.That(overridesNonDirectVirtual.RetInt(foo), Is.EqualTo(3));
                Assert.That(foo.FooPtr, Is.EqualTo(1));
            }
        }
        using (var derivedFromTemplateInstantiationWithVirtual = new DerivedFromTemplateInstantiationWithVirtual())
        {
        }
        using (var hasProtectedEnum = new HasProtectedEnum())
        {
        }
        EnumWithUnderscores e = EnumWithUnderscores.lOWER_BEFORE_CAPITAL;
        e = EnumWithUnderscores.UnderscoreAtEnd;
        e = EnumWithUnderscores.CAPITALS_More;
        e = EnumWithUnderscores.UsesDigits1_0;
        e.GetHashCode();
        ItemsDifferByCase itemsDifferByCase = ItemsDifferByCase.Case_a;
        itemsDifferByCase = ItemsDifferByCase.CaseA;
        itemsDifferByCase.GetHashCode();
        Common.SMallFollowedByCapital();
        using (new DerivedFromSecondaryBaseWithIgnoredVirtualMethod()) { }

#pragma warning restore 0168
#pragma warning restore 0219
    }
예제 #5
0
 public void TestCodeGeneration()
 {
     Assert.That(new ChangedAccessOfInheritedProperty().Property, Is.EqualTo(2));
     Foo.NestedAbstract a;
     var renamedEmptyEnum = Foo.RenamedEmptyEnum.EmptyEnum1;
     using (var foo = new Foo())
     {
         Bar bar = foo;
         Assert.IsTrue(Bar.Item.Item1 == bar);
     }
     using (var overridesNonDirectVirtual = new OverridesNonDirectVirtual())
     {
         Assert.That(overridesNonDirectVirtual.retInt(), Is.EqualTo(3));
     }
     using (var derivedFromTemplateInstantiationWithVirtual = new DerivedFromTemplateInstantiationWithVirtual())
     {
     }
     using (var hasProtectedEnum = new HasProtectedEnum())
     {
     }
 }