public void TestRefOutParams()
        {
            CodeCompletionBugTests.CombinedProviderTest(
                @"using System;
public delegate void FooBar (out int foo, ref int bar, params object[] additional);

public class Test
{
	FooBar foo;

	void TestFoo()
	{
		$foo = d$
	}
}
", provider =>
            {
                Assert.IsFalse(provider.AutoSelect);
                Assert.IsNotNull(provider.Find("(out int foo, ref int bar, object[] additional)"));
                Assert.IsNull(provider.Find("(foo, bar, additional)"));
            });
        }
Exemple #2
0
        public void TestOverloadCount()
        {
            CodeCompletionBugTests.CombinedProviderTest(@"
using System;

class Test
{
	static void Foo () {}
	static void Foo (int i) {}
	static void Foo (int i, string s) {}

	public static void Main (int test)
	{
		$f$	
	}
}
", provider => {
                Assert.AreEqual(1, provider.Data.Count(p => p.DisplayText == "Foo"));
                var data = provider.Find("Foo");
                Assert.AreEqual(3, data.OverloadedData.Count());
            });
        }
        public void TestNewKeywordInInitializer()
        {
            CodeCompletionBugTests.CombinedProviderTest(
                @"using System;

class O
{
	public int Int { get; set; }
	public object Obj { get; set; }
}

class Test
{
	public void Method ()
	{
		$var foo = new O() { Int = 5, Obj = n$
	}
}
", (provider) => {
                Assert.IsNotNull(provider.Find("new"), "keyword 'new' not found.");
            });
        }
        public void TestObjectInitializerContinuation()
        {
            CodeCompletionBugTests.CombinedProviderTest(
                @"
class A
{
	public string Name { get; set; }
}

class MyTest
{
	static string Str = ""hello"";

	public void Test ()
	{
		$var x = new A () { Name = MyTest.$
	}
}
", provider => {
                Assert.IsNotNull(provider.Find("Str"), "field 'Str' not found.");
            });
        }
        public void TestObjectInitializer()
        {
            CodeCompletionBugTests.CombinedProviderTest(
                @"class foo {
	public string bar { get; set; }
	public string baz { get; set; }
}

class test {
	public void testcc ()
	{
		new foo () {
			$b$
		};
	}
}
", provider =>
            {
                Assert.IsNotNull(provider.Find("bar"), "property 'bar' not found.");
                Assert.IsNotNull(provider.Find("baz"), "property 'baz' not found.");
            });
        }
Exemple #6
0
        public void TestImplicitShadowing()
        {
            CodeCompletionBugTests.CombinedProviderTest(@"
using System;

		namespace ConsoleApplication2
		{
			class A
			{
				public int Foo;
			}

			class B : A
			{
				public string Foo;
			}

			class Program
			{
				static void Main (string[] args)
				{
					var b = new B ();
					$b.$
				}
			}
		}"        , provider =>
            {
                int count = 0;
                foreach (var data in provider.Data)
                {
                    if (data.DisplayText == "Foo")
                    {
                        count += data.HasOverloads ? data.OverloadedData.Count() : 1;
                    }
                }
                Assert.AreEqual(1, count);
            });
        }
Exemple #7
0
        public void CheckInstanceMembersAreHiddenInStaticMethod()
        {
            CodeCompletionBugTests.CombinedProviderTest(@"
using System;

class Test
{
	int foo;
	int Foo { get { return foo; } }
	void TestMethod () {}

	public static void Main (string[] args)
	{
		$f$	
	}
}
", provider => {
                Assert.IsNotNull(provider.Find("Main"), "'Main' not found.");
                Assert.IsNotNull(provider.Find("Test"), "'Test' not found.");
                Assert.IsNull(provider.Find("foo"), "'foo' found.");
                Assert.IsNull(provider.Find("Foo"), "'Foo' found.");
                Assert.IsNull(provider.Find("TestMethod"), "'TestMethod' found.");
            });
        }
Exemple #8
0
        public void TestBug19908_Case2()
        {
            CodeCompletionBugTests.CombinedProviderTest(
                @"using System.Collections.Generic;

class Foo
{
	public IList<int> Children { get {} }
}

class Test
{
	public static void Main(string [] args)
	{
		var dict = new Foo {
			$c$
		}
	}
}
",
                provider => {
                Assert.IsNotNull(provider.Find("Children"), "'Children' not found.");
            });
        }
Exemple #9
0
 public void TestBug2198Case2()
 {
     CodeCompletionBugTests.CombinedProviderTest(@"$class Klass { void Test<T$", provider => {
         Assert.AreEqual(0, provider.Count, "provider needs to be empty");
     });
 }
 public void TestIfInsideComment()
 {
     CodeCompletionBugTests.CombinedProviderTest(@"$// #if D$", provider => {
         Assert.IsNull(provider.Find("DEBUG"), "define 'DEBUG' found.");
     });
 }
 public void TestIfContext()
 {
     CodeCompletionBugTests.CombinedProviderTest(@"$#if D$", provider => {
         Assert.IsNotNull(provider.Find("DEBUG"), "define 'DEBUG' not found.");
     });
 }