Example #1
0
        public void TestBug487237()
        {
            CompletionDataList provider = CodeCompletionBugTests.CreateProvider(
                @"
public interface IHelper
{
    void DoIt ();
}

public class Program
{
	delegate T MyDelegate <T> (T t);
    
	static int Main ()
    {
        $MyDelegate<IHelper> e = helper => helper.$
        return 0;
    }
}
");

            Assert.IsNotNull(provider, "provider == null");
            Assert.IsNotNull(provider.Find("DoIt"), "method 'DoIt' not found.");
        }
Example #2
0
        public void TestExplicitResolving()
        {
            CompletionDataList provider = CodeCompletionBugTests.CreateProvider(
                @"
interface IMyInterface {
	object this [object i] { get; }
}

class MyClass<S, T> : IMyInterface
{
	object IMyInterface.this[object i] {
		get {
			return null;
		}
	}
	
	public S this[T i] {
		get {
			return default(S);
		}
	}
}
	
class TestClass
{
	void TestMethod ()
	{
		MyClass<TestClass, string> myClass = new MyClass<TestClass, string> ();
		$myClass[""test""].$
	}
}
");

            Assert.IsNotNull(provider, "provider == null");
            Assert.IsNotNull(provider.Find("TestMethod"), "method 'TestMethod' not found");
        }
Example #3
0
        public void TestImplicitGenericMethodParameter()
        {
            CompletionDataList provider = CodeCompletionBugTests.CreateProvider(
                @"
public class TestClass
{
	public static T TestMethod<T> (T t)
	{
		return t;
	}
}

public class Test
{
	public void TestMethod ()
	{
		$TestClass.TestMethod (this).$
	}
}
 ");

            Assert.IsNotNull(provider, "provider == null");
            Assert.IsNotNull(provider.Find("TestMethod"), "method 'TestMethod' not found");
        }
Example #4
0
        public void TestInternalAccess()
        {
            CompletionDataList provider = CodeCompletionBugTests.CreateProvider(testClass +
                                                                                @"
	void TestMethod () 
	{
		$this.$
	}
}");

            Assert.IsNotNull(provider, "provider == null");

            Assert.IsNotNull(provider.Find("InternalField"));
            Assert.IsNotNull(provider.Find("InternalProperty"));
            Assert.IsNotNull(provider.Find("InternalMethod"));

            Assert.IsNotNull(provider.Find("ProtAndInternalField"));
            Assert.IsNotNull(provider.Find("ProtAndInternalProperty"));
            Assert.IsNotNull(provider.Find("ProtAndInternalMethod"));

            Assert.IsNotNull(provider.Find("ProtOrInternalField"));
            Assert.IsNotNull(provider.Find("ProtOrInternalProperty"));
            Assert.IsNotNull(provider.Find("ProtOrInternalMethod"));
        }
		public static void CheckStaticObjectMembers (CompletionDataList provider)
		{
			Assert.IsNotNull (provider.Find ("Equals"), "Method 'System.Object.Equals' not found.");
			Assert.IsNotNull (provider.Find ("ReferenceEquals"), "Method 'System.Object.ReferenceEquals' not found.");
		}
		public static void CheckProtectedObjectMembers (CompletionDataList provider)
		{
			CheckObjectMembers (provider);
			Assert.IsNotNull (provider.Find ("MemberwiseClone"), "Method 'System.Object.MemberwiseClone' not found.");
		}
		public static void CheckObjectMembers (CompletionDataList provider)
		{
			Assert.IsNotNull (provider.Find ("Equals"), "Method 'System.Object.Equals' not found.");
			Assert.IsNotNull (provider.Find ("GetHashCode"), "Method 'System.Object.GetHashCode' not found.");
			Assert.IsNotNull (provider.Find ("GetType"), "Method 'System.Object.GetType' not found.");
			Assert.IsNotNull (provider.Find ("ToString"), "Method 'System.Object.ToString' not found.");
		}