57 changed files with 10239 additions and 13051 deletions
@ -1,59 +1,60 @@
@@ -1,59 +1,60 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Tests.Utils; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
/// <summary>
|
||||
/// Tests that the IsOverridable property returns the expected value.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class AbstractEntityIsOverridableTestFixture |
||||
{ |
||||
MockEntity entity; |
||||
|
||||
[SetUp] |
||||
public void SetUp() |
||||
{ |
||||
entity = new MockEntity(); |
||||
} |
||||
|
||||
[Test] |
||||
public void NotOverridableByDefault() |
||||
{ |
||||
Assert.IsFalse(entity.IsOverridable); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsOverrideSet() |
||||
{ |
||||
entity.Modifiers = ModifierEnum.Override; |
||||
Assert.IsTrue(entity.IsOverridable); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsVirtualSet() |
||||
{ |
||||
entity.Modifiers = ModifierEnum.Virtual; |
||||
Assert.IsTrue(entity.IsOverridable); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsAbstractSet() |
||||
{ |
||||
entity.Modifiers = ModifierEnum.Abstract; |
||||
Assert.IsTrue(entity.IsOverridable); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsAbstractAndSealedSet() |
||||
{ |
||||
entity.Modifiers = ModifierEnum.Abstract | ModifierEnum.Sealed; |
||||
Assert.IsFalse(entity.IsOverridable); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Tests.Utils;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests that the IsOverridable property returns the expected value.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class AbstractEntityIsOverridableTestFixture
|
||||
// {
|
||||
// MockEntity entity;
|
||||
//
|
||||
// [SetUp]
|
||||
// public void SetUp()
|
||||
// {
|
||||
// entity = new MockEntity();
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void NotOverridableByDefault()
|
||||
// {
|
||||
// Assert.IsFalse(entity.IsOverridable);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void IsOverrideSet()
|
||||
// {
|
||||
// entity.Modifiers = ModifierEnum.Override;
|
||||
// Assert.IsTrue(entity.IsOverridable);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void IsVirtualSet()
|
||||
// {
|
||||
// entity.Modifiers = ModifierEnum.Virtual;
|
||||
// Assert.IsTrue(entity.IsOverridable);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void IsAbstractSet()
|
||||
// {
|
||||
// entity.Modifiers = ModifierEnum.Abstract;
|
||||
// Assert.IsTrue(entity.IsOverridable);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void IsAbstractAndSealedSet()
|
||||
// {
|
||||
// entity.Modifiers = ModifierEnum.Abstract | ModifierEnum.Sealed;
|
||||
// Assert.IsFalse(entity.IsOverridable);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -0,0 +1,116 @@
@@ -0,0 +1,116 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.NRefactory.TypeSystem; |
||||
using ICSharpCode.SharpDevelop.Parser; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class CSharpAmbienceTests |
||||
{ |
||||
IProjectContent mscorlib; |
||||
CSharpAmbience ambience; |
||||
|
||||
[SetUp] |
||||
public void Setup() |
||||
{ |
||||
ambience = new CSharpAmbience(); |
||||
mscorlib = AssemblyParserService.GetAssembly(FileName.Create(typeof(object).Assembly.Location)); |
||||
} |
||||
|
||||
[Test] |
||||
public void GenericType() |
||||
{ |
||||
var typeDef = mscorlib.GetTypeDefinition(typeof(Dictionary<,>)); |
||||
ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedMemberNames | ConversionFlags.ShowTypeParameterList; |
||||
string result = ambience.ConvertEntity(typeDef); |
||||
|
||||
Assert.AreEqual("System.Collections.Generic.Dictionary<TKey, TValue>", result); |
||||
} |
||||
|
||||
[Test] |
||||
public void GenericTypeShortName() |
||||
{ |
||||
var typeDef = mscorlib.GetTypeDefinition(typeof(Dictionary<,>)); |
||||
ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList; |
||||
string result = ambience.ConvertEntity(typeDef); |
||||
|
||||
Assert.AreEqual("Dictionary<TKey, TValue>", result); |
||||
} |
||||
|
||||
[Test] |
||||
public void SimpleType() |
||||
{ |
||||
var typeDef = mscorlib.GetTypeDefinition(typeof(Object)); |
||||
ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedMemberNames | ConversionFlags.ShowTypeParameterList; |
||||
string result = ambience.ConvertEntity(typeDef); |
||||
|
||||
Assert.AreEqual("System.Object", result); |
||||
} |
||||
|
||||
[Test] |
||||
public void SimpleTypeDefinition() |
||||
{ |
||||
var typeDef = mscorlib.GetTypeDefinition(typeof(Object)); |
||||
ambience.ConversionFlags = ConversionFlags.All & ~(ConversionFlags.UseFullyQualifiedMemberNames); |
||||
string result = ambience.ConvertEntity(typeDef); |
||||
|
||||
Assert.AreEqual("public class Object", result); |
||||
} |
||||
|
||||
[Test] |
||||
public void SimpleTypeDefinitionWithoutModifiers() |
||||
{ |
||||
var typeDef = mscorlib.GetTypeDefinition(typeof(Object)); |
||||
ambience.ConversionFlags = ConversionFlags.All & ~(ConversionFlags.UseFullyQualifiedMemberNames | ConversionFlags.ShowModifiers | ConversionFlags.ShowAccessibility); |
||||
string result = ambience.ConvertEntity(typeDef); |
||||
|
||||
Assert.AreEqual("class Object", result); |
||||
} |
||||
|
||||
[Test] |
||||
public void GenericTypeDefinitionFull() |
||||
{ |
||||
var typeDef = mscorlib.GetTypeDefinition(typeof(List<>)); |
||||
ambience.ConversionFlags = ConversionFlags.All; |
||||
string result = ambience.ConvertEntity(typeDef); |
||||
|
||||
Assert.AreEqual("public class System.Collections.Generic.List<T>", result); |
||||
} |
||||
|
||||
[Test] |
||||
public void SimpleTypeShortName() |
||||
{ |
||||
var typeDef = mscorlib.GetTypeDefinition(typeof(Object)); |
||||
ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList; |
||||
string result = ambience.ConvertEntity(typeDef); |
||||
|
||||
Assert.AreEqual("Object", result); |
||||
} |
||||
|
||||
[Test] |
||||
public void GenericTypeWithNested() |
||||
{ |
||||
var typeDef = mscorlib.GetTypeDefinition(typeof(List<>.Enumerator)); |
||||
ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedMemberNames | ConversionFlags.ShowTypeParameterList; |
||||
string result = ambience.ConvertEntity(typeDef); |
||||
|
||||
Assert.AreEqual("System.Collections.Generic.List<T>.Enumerator", result); |
||||
} |
||||
|
||||
[Test] |
||||
public void GenericTypeWithNestedShortName() |
||||
{ |
||||
var typeDef = mscorlib.GetTypeDefinition(typeof(List<>.Enumerator)); |
||||
ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList; |
||||
string result = ambience.ConvertEntity(typeDef); |
||||
|
||||
Assert.AreEqual("List<T>.Enumerator", result); |
||||
} |
||||
} |
||||
} |
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,93 +1,94 @@
@@ -1,93 +1,94 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Reflection; |
||||
using System.Text; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
/// <summary>
|
||||
/// SD2-1199. Tests the available overrides for the
|
||||
/// System.Collections.ObjectModel.Collection class.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class CollectionClassOverridesTestFixture |
||||
{ |
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
PropertyService.InitializeServiceForUnitTests(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This shows how to get the list of overridable methods in the
|
||||
/// Collection class using reflection only.
|
||||
/// </summary>
|
||||
public void GetMethodsThroughReflection() |
||||
{ |
||||
Assembly a = Assembly.Load("mscorlib"); |
||||
Type t = a.GetType("System.Collections.ObjectModel.Collection`1"); |
||||
|
||||
List<string> methodNames = new List<string>(); |
||||
BindingFlags bindingFlags = BindingFlags.Instance | |
||||
BindingFlags.NonPublic | |
||||
BindingFlags.DeclaredOnly | |
||||
BindingFlags.Public; |
||||
|
||||
foreach (MethodInfo m in t.GetMethods(bindingFlags)) { |
||||
if (m.IsVirtual && !m.IsSpecialName && !m.IsFinal) { |
||||
methodNames.Add(m.Name); |
||||
} |
||||
} |
||||
|
||||
List<string> expectedMethodNames = new List<string>(); |
||||
expectedMethodNames.Add("ClearItems"); |
||||
expectedMethodNames.Add("InsertItem"); |
||||
expectedMethodNames.Add("RemoveItem"); |
||||
expectedMethodNames.Add("SetItem"); |
||||
|
||||
StringBuilder sb = new StringBuilder(); |
||||
foreach (string s in methodNames.ToArray()) { |
||||
sb.AppendLine(s); |
||||
} |
||||
Assert.AreEqual(expectedMethodNames.ToArray(), methodNames.ToArray(), sb.ToString()); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Tests that the IsSealed property is set for methods that are
|
||||
/// flagged as final. The ReflectionMethod class was not setting
|
||||
/// this correctly.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void ExpectedMethodsFromProjectContent() |
||||
{ |
||||
ProjectContentRegistry registry = new ProjectContentRegistry(); |
||||
IProjectContent mscorlibProjectContent = registry.Mscorlib; |
||||
IClass c = mscorlibProjectContent.GetClass("System.Collections.ObjectModel.Collection", 1); |
||||
|
||||
List<string> methodNames = new List<string>(); |
||||
foreach (IMethod m in c.Methods) { |
||||
if (m.IsVirtual && !m.IsSealed) { |
||||
methodNames.Add(m.Name); |
||||
} |
||||
} |
||||
|
||||
List<string> expectedMethodNames = new List<string>(); |
||||
expectedMethodNames.Add("ClearItems"); |
||||
expectedMethodNames.Add("InsertItem"); |
||||
expectedMethodNames.Add("RemoveItem"); |
||||
expectedMethodNames.Add("SetItem"); |
||||
|
||||
methodNames.Sort(); |
||||
expectedMethodNames.Sort(); |
||||
|
||||
Assert.AreEqual(expectedMethodNames.ToArray(), methodNames.ToArray()); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Reflection;
|
||||
//using System.Text;
|
||||
//
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// SD2-1199. Tests the available overrides for the
|
||||
// /// System.Collections.ObjectModel.Collection class.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class CollectionClassOverridesTestFixture
|
||||
// {
|
||||
// [TestFixtureSetUp]
|
||||
// public void SetUpFixture()
|
||||
// {
|
||||
// PropertyService.InitializeServiceForUnitTests();
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// This shows how to get the list of overridable methods in the
|
||||
// /// Collection class using reflection only.
|
||||
// /// </summary>
|
||||
// public void GetMethodsThroughReflection()
|
||||
// {
|
||||
// Assembly a = Assembly.Load("mscorlib");
|
||||
// Type t = a.GetType("System.Collections.ObjectModel.Collection`1");
|
||||
//
|
||||
// List<string> methodNames = new List<string>();
|
||||
// BindingFlags bindingFlags = BindingFlags.Instance |
|
||||
// BindingFlags.NonPublic |
|
||||
// BindingFlags.DeclaredOnly |
|
||||
// BindingFlags.Public;
|
||||
//
|
||||
// foreach (MethodInfo m in t.GetMethods(bindingFlags)) {
|
||||
// if (m.IsVirtual && !m.IsSpecialName && !m.IsFinal) {
|
||||
// methodNames.Add(m.Name);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List<string> expectedMethodNames = new List<string>();
|
||||
// expectedMethodNames.Add("ClearItems");
|
||||
// expectedMethodNames.Add("InsertItem");
|
||||
// expectedMethodNames.Add("RemoveItem");
|
||||
// expectedMethodNames.Add("SetItem");
|
||||
//
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// foreach (string s in methodNames.ToArray()) {
|
||||
// sb.AppendLine(s);
|
||||
// }
|
||||
// Assert.AreEqual(expectedMethodNames.ToArray(), methodNames.ToArray(), sb.ToString());
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Tests that the IsSealed property is set for methods that are
|
||||
// /// flagged as final. The ReflectionMethod class was not setting
|
||||
// /// this correctly.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void ExpectedMethodsFromProjectContent()
|
||||
// {
|
||||
// ProjectContentRegistry registry = new ProjectContentRegistry();
|
||||
// IProjectContent mscorlibProjectContent = registry.Mscorlib;
|
||||
// IClass c = mscorlibProjectContent.GetClass("System.Collections.ObjectModel.Collection", 1);
|
||||
//
|
||||
// List<string> methodNames = new List<string>();
|
||||
// foreach (IMethod m in c.Methods) {
|
||||
// if (m.IsVirtual && !m.IsSealed) {
|
||||
// methodNames.Add(m.Name);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List<string> expectedMethodNames = new List<string>();
|
||||
// expectedMethodNames.Add("ClearItems");
|
||||
// expectedMethodNames.Add("InsertItem");
|
||||
// expectedMethodNames.Add("RemoveItem");
|
||||
// expectedMethodNames.Add("SetItem");
|
||||
//
|
||||
// methodNames.Sort();
|
||||
// expectedMethodNames.Sort();
|
||||
//
|
||||
// Assert.AreEqual(expectedMethodNames.ToArray(), methodNames.ToArray());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,94 +1,95 @@
@@ -1,94 +1,95 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Reflection; |
||||
using System.Text; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
/// <summary>
|
||||
/// Tests the available overrides for the
|
||||
/// System.Exception class.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class ExceptionClassOverridesTestFixture |
||||
{ |
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
PropertyService.InitializeServiceForUnitTests(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// This shows how to get the list of overridable properties in the
|
||||
/// Exception class using reflection only.
|
||||
/// </summary>
|
||||
public void GetPropertiesThroughReflection() |
||||
{ |
||||
Assembly a = Assembly.Load("mscorlib"); |
||||
Type t = a.GetType("System.Exception"); |
||||
|
||||
List<string> propertyNames = new List<string>(); |
||||
BindingFlags bindingFlags = BindingFlags.Instance | |
||||
BindingFlags.NonPublic | |
||||
BindingFlags.DeclaredOnly | |
||||
BindingFlags.Public; |
||||
|
||||
foreach (PropertyInfo p in t.GetProperties(bindingFlags)) { |
||||
MethodInfo m = p.GetGetMethod(true); |
||||
if (m.IsVirtual && !m.IsPrivate && !m.IsFinal) { |
||||
propertyNames.Add(p.Name); |
||||
} |
||||
} |
||||
|
||||
List<string> expectedPropertyNames = new List<string>(); |
||||
expectedPropertyNames.Add("Data"); |
||||
expectedPropertyNames.Add("HelpLink"); |
||||
expectedPropertyNames.Add("Message"); |
||||
expectedPropertyNames.Add("Source"); |
||||
expectedPropertyNames.Add("StackTrace"); |
||||
|
||||
StringBuilder sb = new StringBuilder(); |
||||
foreach (string s in propertyNames.ToArray()) { |
||||
sb.AppendLine(s); |
||||
} |
||||
Assert.AreEqual(expectedPropertyNames.ToArray(), propertyNames.ToArray(), sb.ToString()); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Tests that the IsSealed property is set for properties that are
|
||||
/// flagged as final. The ReflectionProperty class was not setting
|
||||
/// this correctly.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void ExpectedPropertiesFromProjectContent() |
||||
{ |
||||
ProjectContentRegistry registry = new ProjectContentRegistry(); |
||||
IProjectContent mscorlibProjectContent = registry.Mscorlib; |
||||
IClass c = mscorlibProjectContent.GetClass("System.Exception", 0); |
||||
|
||||
List<string> propertyNames = new List<string>(); |
||||
foreach (IProperty p in c.Properties) { |
||||
if (p.IsVirtual && !p.IsSealed) { |
||||
propertyNames.Add(p.Name); |
||||
} |
||||
} |
||||
propertyNames.Sort(); |
||||
|
||||
List<string> expectedPropertyNames = new List<string>(); |
||||
expectedPropertyNames.Add("Data"); |
||||
expectedPropertyNames.Add("HelpLink"); |
||||
expectedPropertyNames.Add("Message"); |
||||
expectedPropertyNames.Add("Source"); |
||||
expectedPropertyNames.Add("StackTrace"); |
||||
|
||||
Assert.AreEqual(expectedPropertyNames.ToArray(), propertyNames.ToArray()); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Reflection;
|
||||
//using System.Text;
|
||||
//
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests the available overrides for the
|
||||
// /// System.Exception class.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class ExceptionClassOverridesTestFixture
|
||||
// {
|
||||
// [TestFixtureSetUp]
|
||||
// public void SetUpFixture()
|
||||
// {
|
||||
// PropertyService.InitializeServiceForUnitTests();
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// This shows how to get the list of overridable properties in the
|
||||
// /// Exception class using reflection only.
|
||||
// /// </summary>
|
||||
// public void GetPropertiesThroughReflection()
|
||||
// {
|
||||
// Assembly a = Assembly.Load("mscorlib");
|
||||
// Type t = a.GetType("System.Exception");
|
||||
//
|
||||
// List<string> propertyNames = new List<string>();
|
||||
// BindingFlags bindingFlags = BindingFlags.Instance |
|
||||
// BindingFlags.NonPublic |
|
||||
// BindingFlags.DeclaredOnly |
|
||||
// BindingFlags.Public;
|
||||
//
|
||||
// foreach (PropertyInfo p in t.GetProperties(bindingFlags)) {
|
||||
// MethodInfo m = p.GetGetMethod(true);
|
||||
// if (m.IsVirtual && !m.IsPrivate && !m.IsFinal) {
|
||||
// propertyNames.Add(p.Name);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List<string> expectedPropertyNames = new List<string>();
|
||||
// expectedPropertyNames.Add("Data");
|
||||
// expectedPropertyNames.Add("HelpLink");
|
||||
// expectedPropertyNames.Add("Message");
|
||||
// expectedPropertyNames.Add("Source");
|
||||
// expectedPropertyNames.Add("StackTrace");
|
||||
//
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// foreach (string s in propertyNames.ToArray()) {
|
||||
// sb.AppendLine(s);
|
||||
// }
|
||||
// Assert.AreEqual(expectedPropertyNames.ToArray(), propertyNames.ToArray(), sb.ToString());
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Tests that the IsSealed property is set for properties that are
|
||||
// /// flagged as final. The ReflectionProperty class was not setting
|
||||
// /// this correctly.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void ExpectedPropertiesFromProjectContent()
|
||||
// {
|
||||
// ProjectContentRegistry registry = new ProjectContentRegistry();
|
||||
// IProjectContent mscorlibProjectContent = registry.Mscorlib;
|
||||
// IClass c = mscorlibProjectContent.GetClass("System.Exception", 0);
|
||||
//
|
||||
// List<string> propertyNames = new List<string>();
|
||||
// foreach (IProperty p in c.Properties) {
|
||||
// if (p.IsVirtual && !p.IsSealed) {
|
||||
// propertyNames.Add(p.Name);
|
||||
// }
|
||||
// }
|
||||
// propertyNames.Sort();
|
||||
//
|
||||
// List<string> expectedPropertyNames = new List<string>();
|
||||
// expectedPropertyNames.Add("Data");
|
||||
// expectedPropertyNames.Add("HelpLink");
|
||||
// expectedPropertyNames.Add("Message");
|
||||
// expectedPropertyNames.Add("Source");
|
||||
// expectedPropertyNames.Add("StackTrace");
|
||||
//
|
||||
// Assert.AreEqual(expectedPropertyNames.ToArray(), propertyNames.ToArray());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,85 +1,86 @@
@@ -1,85 +1,86 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using ICSharpCode.NRefactory.Ast; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Dom.Refactoring; |
||||
using NUnit.Framework; |
||||
using System.Text; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
/// <summary>
|
||||
/// Description of GenerateOverrideMethod.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class GenerateOverrideMethodTests |
||||
{ |
||||
NRefactoryResolverTests helper = new NRefactoryResolverTests(); |
||||
|
||||
void Run(string input, string expectedOutput) |
||||
{ |
||||
ICompilationUnit cu = helper.Parse("a.cs", input + "\nclass DerivedClass {\n \n}"); |
||||
Assert.AreEqual(2, cu.Classes.Count); |
||||
Assert.AreEqual(1, cu.Classes[0].Methods.Count + cu.Classes[0].Properties.Count); |
||||
IMember virtualMember; |
||||
if (cu.Classes[0].Properties.Count > 0) |
||||
virtualMember = cu.Classes[0].Properties[0]; |
||||
else |
||||
virtualMember = cu.Classes[0].Methods[0]; |
||||
CSharpCodeGenerator ccg = new CSharpCodeGenerator(); |
||||
AttributedNode result = ccg.GetOverridingMethod(virtualMember, new ClassFinder(cu.Classes[1], 3, 1)); |
||||
Assert.IsNotNull(result); |
||||
string output = ccg.GenerateCode(result, ""); |
||||
Assert.AreEqual(expectedOutput, NormalizeWhitespace(output)); |
||||
} |
||||
|
||||
string NormalizeWhitespace(string t) |
||||
{ |
||||
StringBuilder b = new StringBuilder(); |
||||
bool wasWhitespace = true; |
||||
foreach (char c in t) { |
||||
if (char.IsWhiteSpace(c)) { |
||||
if (!wasWhitespace) { |
||||
wasWhitespace = true; |
||||
b.Append(' '); |
||||
} |
||||
} else { |
||||
b.Append(c); |
||||
wasWhitespace = false; |
||||
} |
||||
} |
||||
return b.ToString().Trim(); |
||||
} |
||||
|
||||
[Test] |
||||
public void ReadonlyVirtualProperty() |
||||
{ |
||||
Run("class BaseClass { public virtual int Prop { get { return 0; } } }", |
||||
"public override int Prop { get { return base.Prop; } }"); |
||||
} |
||||
|
||||
[Test] |
||||
public void ReadonlyAbstractProperty() |
||||
{ |
||||
Run("class BaseClass { public abstract int Prop { get; } }", |
||||
"public override int Prop { get { throw new NotImplementedException(); } }"); |
||||
} |
||||
|
||||
[Test] |
||||
public void ReadWriteProperty() |
||||
{ |
||||
Run("class BaseClass { public virtual int Prop { get { return 0; } set { } } }", |
||||
"public override int Prop { get { return base.Prop; } set { base.Prop = value; } }"); |
||||
} |
||||
|
||||
[Test] |
||||
public void PublicReadProtectedWriteProperty() |
||||
{ |
||||
Run("class BaseClass { public virtual int Prop { get { return 0; } protected set { } } }", |
||||
"public override int Prop { get { return base.Prop; } protected set { base.Prop = value; } }"); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Linq;
|
||||
//using ICSharpCode.NRefactory.Ast;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Dom.Refactoring;
|
||||
//using NUnit.Framework;
|
||||
//using System.Text;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Description of GenerateOverrideMethod.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class GenerateOverrideMethodTests
|
||||
// {
|
||||
// NRefactoryResolverTests helper = new NRefactoryResolverTests();
|
||||
//
|
||||
// void Run(string input, string expectedOutput)
|
||||
// {
|
||||
// ICompilationUnit cu = helper.Parse("a.cs", input + "\nclass DerivedClass {\n \n}");
|
||||
// Assert.AreEqual(2, cu.Classes.Count);
|
||||
// Assert.AreEqual(1, cu.Classes[0].Methods.Count + cu.Classes[0].Properties.Count);
|
||||
// IMember virtualMember;
|
||||
// if (cu.Classes[0].Properties.Count > 0)
|
||||
// virtualMember = cu.Classes[0].Properties[0];
|
||||
// else
|
||||
// virtualMember = cu.Classes[0].Methods[0];
|
||||
// CSharpCodeGenerator ccg = new CSharpCodeGenerator();
|
||||
// AttributedNode result = ccg.GetOverridingMethod(virtualMember, new ClassFinder(cu.Classes[1], 3, 1));
|
||||
// Assert.IsNotNull(result);
|
||||
// string output = ccg.GenerateCode(result, "");
|
||||
// Assert.AreEqual(expectedOutput, NormalizeWhitespace(output));
|
||||
// }
|
||||
//
|
||||
// string NormalizeWhitespace(string t)
|
||||
// {
|
||||
// StringBuilder b = new StringBuilder();
|
||||
// bool wasWhitespace = true;
|
||||
// foreach (char c in t) {
|
||||
// if (char.IsWhiteSpace(c)) {
|
||||
// if (!wasWhitespace) {
|
||||
// wasWhitespace = true;
|
||||
// b.Append(' ');
|
||||
// }
|
||||
// } else {
|
||||
// b.Append(c);
|
||||
// wasWhitespace = false;
|
||||
// }
|
||||
// }
|
||||
// return b.ToString().Trim();
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ReadonlyVirtualProperty()
|
||||
// {
|
||||
// Run("class BaseClass { public virtual int Prop { get { return 0; } } }",
|
||||
// "public override int Prop { get { return base.Prop; } }");
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ReadonlyAbstractProperty()
|
||||
// {
|
||||
// Run("class BaseClass { public abstract int Prop { get; } }",
|
||||
// "public override int Prop { get { throw new NotImplementedException(); } }");
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ReadWriteProperty()
|
||||
// {
|
||||
// Run("class BaseClass { public virtual int Prop { get { return 0; } set { } } }",
|
||||
// "public override int Prop { get { return base.Prop; } set { base.Prop = value; } }");
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void PublicReadProtectedWriteProperty()
|
||||
// {
|
||||
// Run("class BaseClass { public virtual int Prop { get { return 0; } protected set { } } }",
|
||||
// "public override int Prop { get { return base.Prop; } protected set { base.Prop = value; } }");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,58 +1,59 @@
@@ -1,58 +1,59 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Reflection; |
||||
|
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class GetElementByReflectionNameTests |
||||
{ |
||||
IProjectContent mscorlib = AssemblyParserService.DefaultProjectContentRegistry.Mscorlib; |
||||
|
||||
void TestClass(Type type) |
||||
{ |
||||
Assert.AreSame(typeof(object).Assembly, type.Assembly); |
||||
IClass c = (IClass)mscorlib.GetClassByReflectionName(type.FullName, false); |
||||
Assert.AreEqual(type.FullName, c.DotNetName); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestClasses() |
||||
{ |
||||
TestClass(typeof(object)); |
||||
TestClass(typeof(Nullable)); |
||||
TestClass(typeof(Nullable<>)); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestNestedClass() |
||||
{ |
||||
TestClass(typeof(Environment.SpecialFolder)); |
||||
TestClass(typeof(Dictionary<,>.ValueCollection)); |
||||
} |
||||
|
||||
void TestMember(string className, string memberName) |
||||
{ |
||||
IClass c = mscorlib.GetClassByReflectionName(className, false); |
||||
Assert.IsNotNull(c); |
||||
AbstractMember m = (AbstractMember)DefaultProjectContent.GetMemberByReflectionName(c, memberName); |
||||
Assert.AreEqual(className + "." + memberName, m.DocumentationTag.Substring(2)); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestConstructor() |
||||
{ |
||||
TestMember("System.Collections.ObjectModel.KeyedCollection`2", "#ctor"); |
||||
TestMember("System.Collections.ObjectModel.KeyedCollection`2", "#ctor(System.Collections.Generic.IEqualityComparer{`0},System.Int32)"); |
||||
TestMember("System.Runtime.InteropServices.CurrencyWrapper", "#ctor(System.Decimal)"); |
||||
TestMember("System.Runtime.InteropServices.CurrencyWrapper", "#ctor(System.Object)"); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Reflection;
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// [TestFixture]
|
||||
// public class GetElementByReflectionNameTests
|
||||
// {
|
||||
// IProjectContent mscorlib = AssemblyParserService.DefaultProjectContentRegistry.Mscorlib;
|
||||
//
|
||||
// void TestClass(Type type)
|
||||
// {
|
||||
// Assert.AreSame(typeof(object).Assembly, type.Assembly);
|
||||
// IClass c = (IClass)mscorlib.GetClassByReflectionName(type.FullName, false);
|
||||
// Assert.AreEqual(type.FullName, c.DotNetName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void TestClasses()
|
||||
// {
|
||||
// TestClass(typeof(object));
|
||||
// TestClass(typeof(Nullable));
|
||||
// TestClass(typeof(Nullable<>));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void TestNestedClass()
|
||||
// {
|
||||
// TestClass(typeof(Environment.SpecialFolder));
|
||||
// TestClass(typeof(Dictionary<,>.ValueCollection));
|
||||
// }
|
||||
//
|
||||
// void TestMember(string className, string memberName)
|
||||
// {
|
||||
// IClass c = mscorlib.GetClassByReflectionName(className, false);
|
||||
// Assert.IsNotNull(c);
|
||||
// AbstractMember m = (AbstractMember)DefaultProjectContent.GetMemberByReflectionName(c, memberName);
|
||||
// Assert.AreEqual(className + "." + memberName, m.DocumentationTag.Substring(2));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void TestConstructor()
|
||||
// {
|
||||
// TestMember("System.Collections.ObjectModel.KeyedCollection`2", "#ctor");
|
||||
// TestMember("System.Collections.ObjectModel.KeyedCollection`2", "#ctor(System.Collections.Generic.IEqualityComparer{`0},System.Int32)");
|
||||
// TestMember("System.Runtime.InteropServices.CurrencyWrapper", "#ctor(System.Decimal)");
|
||||
// TestMember("System.Runtime.InteropServices.CurrencyWrapper", "#ctor(System.Object)");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,478 +1,479 @@
@@ -1,478 +1,479 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class InnerClassesResolverTests |
||||
{ |
||||
#region Test helper methods
|
||||
NRefactoryResolverTests nrrt = new NRefactoryResolverTests(); |
||||
|
||||
ResolveResult Resolve(string program, string expression, int line) |
||||
{ |
||||
return nrrt.Resolve(program, expression, line); |
||||
} |
||||
|
||||
T Resolve<T>(string program, string expression, int line) where T : ResolveResult |
||||
{ |
||||
return nrrt.Resolve<T>(program, expression, line); |
||||
} |
||||
|
||||
T ResolveVB<T>(string program, string expression, int line) where T : ResolveResult |
||||
{ |
||||
return nrrt.ResolveVB<T>(program, expression, line); |
||||
} |
||||
|
||||
List<ICompletionEntry> CtrlSpace(string program, int line) |
||||
{ |
||||
return nrrt.CtrlSpaceResolveCSharp(program, line, ExpressionContext.Default); |
||||
} |
||||
#endregion
|
||||
|
||||
#region Ctrl-Space tests
|
||||
[Test] |
||||
public void CtrlSpaceIncludesInnerClass() |
||||
{ |
||||
string program = @"class A {
|
||||
class Inner { } |
||||
|
||||
}";
|
||||
Assert.IsTrue(IsInnerClassVisible(CtrlSpace(program, 3))); |
||||
} |
||||
|
||||
[Test] |
||||
public void CtrlSpaceIncludesInheritedInnerClass() |
||||
{ |
||||
string program = @"class A : Outer {
|
||||
|
||||
} |
||||
class Outer { protected class Inner { } } |
||||
";
|
||||
Assert.IsTrue(IsInnerClassVisible(CtrlSpace(program, 2))); |
||||
} |
||||
|
||||
[Test] |
||||
public void CtrlSpaceDoesNotIncludeInheritedPrivateInnerClass() |
||||
{ |
||||
string program = @"class A : Outer {
|
||||
|
||||
} |
||||
class Outer { class Inner { } } |
||||
";
|
||||
Assert.IsFalse(IsInnerClassVisible(CtrlSpace(program, 2))); |
||||
} |
||||
|
||||
[Test] |
||||
public void CtrlSpaceIncludesInnerClassFromOtherPart() |
||||
{ |
||||
string program = @"partial class A {
|
||||
|
||||
} |
||||
partial class A { class Inner { } } |
||||
";
|
||||
Assert.IsTrue(IsInnerClassVisible(CtrlSpace(program, 2))); |
||||
} |
||||
#endregion
|
||||
|
||||
[Test] |
||||
public void InnerClassTest() |
||||
{ |
||||
string program = @"using System;
|
||||
class A { |
||||
|
||||
} |
||||
";
|
||||
ResolveResult result = Resolve<TypeResolveResult>(program, "Environment.SpecialFolder", 3); |
||||
Assert.AreEqual("System.Environment.SpecialFolder", result.ResolvedType.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void SimpleInnerClass() |
||||
{ |
||||
string program = @"class A {
|
||||
void Test() { |
||||
|
||||
} |
||||
class B { } |
||||
} |
||||
";
|
||||
ResolveResult result = Resolve(program, "B", 3); |
||||
Assert.IsTrue(result is TypeResolveResult); |
||||
Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void InnerClassWithStaticFieldOfSameType() |
||||
{ |
||||
string program = @"class A {
|
||||
void Test() { |
||||
|
||||
} |
||||
class B { |
||||
public static B Instance; |
||||
} |
||||
} |
||||
";
|
||||
ResolveResult result = Resolve(program, "B.Instance", 3); |
||||
Assert.IsTrue(result is MemberResolveResult); |
||||
Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void InnerClassWithStaticFieldOfSameTypeInPartialClass1() |
||||
{ |
||||
string program = @"partial class A {
|
||||
void Test() { |
||||
|
||||
} |
||||
} |
||||
partial class A { |
||||
class B { |
||||
public static B Instance; |
||||
} |
||||
} |
||||
";
|
||||
ResolveResult result = Resolve(program, "B.Instance", 3); |
||||
Assert.IsTrue(result is MemberResolveResult); |
||||
Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void InnerClassWithStaticFieldOfSameTypeInPartialClass2() |
||||
{ |
||||
string program = @"partial class A {
|
||||
void Test() { |
||||
|
||||
} |
||||
class B { |
||||
public static B Instance; |
||||
} |
||||
} |
||||
partial class A { |
||||
} |
||||
";
|
||||
ResolveResult result = Resolve(program, "B.Instance", 3); |
||||
Assert.IsTrue(result is MemberResolveResult); |
||||
Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void ReflectionInnerClass() |
||||
{ |
||||
string program = @"using System;
|
||||
class A { |
||||
void Test() { |
||||
|
||||
} |
||||
} |
||||
";
|
||||
ResolveResult result = Resolve(program, "Environment.SpecialFolder", 3); |
||||
Assert.IsTrue(result is TypeResolveResult); |
||||
Assert.AreEqual("System.Environment.SpecialFolder", result.ResolvedType.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void OuterclassPrivateFieldCtrlSpaceTest() |
||||
{ |
||||
string program = @"class A
|
||||
{ |
||||
int myField; |
||||
class B |
||||
{ |
||||
void MyMethod(A a) |
||||
{ |
||||
|
||||
} |
||||
} |
||||
} |
||||
";
|
||||
ResolveResult result = Resolve(program, "a", 8); |
||||
Assert.IsNotNull(result, "result"); |
||||
Assert.IsTrue(result is LocalResolveResult, "result is LocalResolveResult"); |
||||
var arr = result.GetCompletionData(nrrt.lastPC); |
||||
Assert.IsNotNull(arr, "arr"); |
||||
foreach (object o in arr) { |
||||
if (o is IField) { |
||||
Assert.AreEqual("myField", ((IField)o).Name); |
||||
return; |
||||
} |
||||
} |
||||
Assert.Fail("private field not visible from inner class"); |
||||
} |
||||
|
||||
[Test] |
||||
public void OuterclassStaticFieldResolveTest() |
||||
{ |
||||
string program = @"class A
|
||||
{ |
||||
static int myField; |
||||
class B |
||||
{ |
||||
void MyMethod() |
||||
{ |
||||
|
||||
} |
||||
} |
||||
} |
||||
";
|
||||
MemberResolveResult result = Resolve<MemberResolveResult>(program, "myField", 8); |
||||
Assert.AreEqual("A.myField", result.ResolvedMember.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void OuterclassStaticMethodCallResolveTest() |
||||
{ |
||||
string program = @"class A
|
||||
{ |
||||
static void Test(int arg); |
||||
class B |
||||
{ |
||||
void MyMethod() |
||||
{ |
||||
|
||||
} |
||||
} |
||||
} |
||||
";
|
||||
MemberResolveResult result = Resolve<MemberResolveResult>(program, "Test(4)", 8); |
||||
Assert.AreEqual("A.Test", result.ResolvedMember.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void InheritedInnerClass() |
||||
{ |
||||
string program = @"class A {
|
||||
protected class B { } |
||||
} |
||||
class C : A { |
||||
void Main() { |
||||
|
||||
} |
||||
} |
||||
";
|
||||
ResolveResult result = Resolve(program, "B", 6); |
||||
Assert.IsTrue(result is TypeResolveResult); |
||||
Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName); |
||||
|
||||
result = Resolve(program, "C.B", 6); |
||||
Assert.IsTrue(result is TypeResolveResult); |
||||
Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName); |
||||
|
||||
result = Resolve(program, "C", 6); |
||||
Assert.IsTrue(result is TypeResolveResult); |
||||
Assert.AreEqual("C", result.ResolvedType.FullyQualifiedName); |
||||
foreach (object o in result.GetCompletionData(nrrt.lastPC)) { |
||||
if (o is IClass) { |
||||
Assert.AreEqual("A.B", ((IClass)o).FullyQualifiedName); |
||||
return; |
||||
} |
||||
} |
||||
Assert.Fail("Inherited inner class not visible."); |
||||
} |
||||
|
||||
[Test] |
||||
public void NestedClassHidingHidesAllMethods() |
||||
{ |
||||
string program = @"using System;
|
||||
class A { |
||||
static void Test(int arg) {} |
||||
static void Test(string arg) {} |
||||
class B { |
||||
void MyMethod() { |
||||
|
||||
} |
||||
static void Test(long arg) {} |
||||
} |
||||
}";
|
||||
MemberResolveResult result = Resolve<MemberResolveResult>(program, "Test(4)", 7); |
||||
Assert.AreEqual("A.B.Test", result.ResolvedMember.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void NestedInnerClasses() |
||||
{ |
||||
string program = @"using System;
|
||||
public sealed class GL { |
||||
void Test() { |
||||
|
||||
} |
||||
|
||||
public class Enums |
||||
{ |
||||
public enum BeginMode {QUADS, LINES } |
||||
} |
||||
} |
||||
";
|
||||
TypeResolveResult trr = Resolve<TypeResolveResult>(program, "GL.Enums.BeginMode", 4); |
||||
Assert.AreEqual("GL.Enums.BeginMode", trr.ResolvedClass.FullyQualifiedName); |
||||
|
||||
trr = Resolve<TypeResolveResult>(program, "Enums.BeginMode", 4); |
||||
Assert.AreEqual("GL.Enums.BeginMode", trr.ResolvedClass.FullyQualifiedName); |
||||
|
||||
MemberResolveResult mrr = Resolve<MemberResolveResult>(program, "GL.Enums.BeginMode.LINES", 4); |
||||
Assert.AreEqual("GL.Enums.BeginMode.LINES", mrr.ResolvedMember.FullyQualifiedName); |
||||
|
||||
mrr = Resolve<MemberResolveResult>(program, "Enums.BeginMode.LINES", 4); |
||||
Assert.AreEqual("GL.Enums.BeginMode.LINES", mrr.ResolvedMember.FullyQualifiedName); |
||||
|
||||
// ensure that GetClass works correctly:
|
||||
IClass c = trr.ResolvedClass.ProjectContent.GetClass("GL.Enums.BeginMode", 0); |
||||
Assert.IsNotNull(c); |
||||
Assert.AreEqual("GL.Enums.BeginMode", c.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void DoNotShowInaccessibleInnerClass() |
||||
{ |
||||
string program = @"using System;
|
||||
class C { |
||||
|
||||
} |
||||
class Outer { private class Inner { } } |
||||
";
|
||||
TypeResolveResult trr = Resolve<TypeResolveResult>(program, "Outer", 3); |
||||
var l = trr.GetCompletionData(trr.ResolvedClass.ProjectContent); |
||||
Assert.IsFalse(IsInnerClassVisible(l)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ShowProtectedInnerClassFromDerivedClass() |
||||
{ |
||||
string program = @"using System;
|
||||
class Derived : Outer { |
||||
|
||||
} |
||||
class Outer { protected class Inner {} } |
||||
";
|
||||
TypeResolveResult trr = Resolve<TypeResolveResult>(program, "Outer", 3); |
||||
var l = trr.GetCompletionData(trr.ResolvedClass.ProjectContent); |
||||
Assert.IsTrue(IsInnerClassVisible(l)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ShowProtectedInnerClassThroughForeignDerivedClass() |
||||
{ |
||||
string program = @"using System;
|
||||
class Derived : Outer { |
||||
|
||||
} |
||||
class Derived2 : Outer { } |
||||
class Outer { protected class Inner {} } |
||||
";
|
||||
TypeResolveResult trr = Resolve<TypeResolveResult>(program, "Derived2", 3); |
||||
var l = trr.GetCompletionData(trr.ResolvedClass.ProjectContent); |
||||
Assert.IsTrue(IsInnerClassVisible(l)); |
||||
} |
||||
|
||||
[Test] |
||||
public void DoNotShowProtectedInnerClassThroughUnrelatedClass() |
||||
{ |
||||
string program = @"using System;
|
||||
class Unrelated { |
||||
|
||||
} |
||||
class Derived : Outer { } |
||||
class Outer { protected class Inner {} } |
||||
";
|
||||
TypeResolveResult trr = Resolve<TypeResolveResult>(program, "Derived", 3); |
||||
var l = trr.GetCompletionData(trr.ResolvedClass.ProjectContent); |
||||
Assert.IsFalse(IsInnerClassVisible(l)); |
||||
} |
||||
|
||||
bool IsInnerClassVisible(IEnumerable l) |
||||
{ |
||||
foreach (object o in l) { |
||||
IClass c = o as IClass; |
||||
if (c != null && c.Name == "Inner") |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
[Test] |
||||
public void GenericInnerClassOrNonGenericOuterClass() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
|
||||
class TheClass<T> {} |
||||
} |
||||
class TheClass { } |
||||
";
|
||||
TypeResolveResult trr = Resolve<TypeResolveResult>(program, "TheClass<string>", 3); |
||||
Assert.AreEqual("Test.TheClass", trr.ResolvedClass.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void GenericInnerClassOrNonGenericOuterClass2() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
TheClass<string> x; |
||||
|
||||
class TheClass<T> {} |
||||
} |
||||
class TheClass { } |
||||
";
|
||||
MemberResolveResult rr = Resolve<MemberResolveResult>(program, "x", 3); |
||||
Assert.AreEqual("Test.TheClass", rr.ResolvedType.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void GenericInnerClassOrNonGenericInnerClass() |
||||
{ |
||||
string program = @"using System;
|
||||
class Test { |
||||
TheClass<string> x1; |
||||
TheClass x2; |
||||
Test.TheClass<string> y1; |
||||
Test.TheClass y2; |
||||
global::Test.TheClass<string> z1; |
||||
global::Test.TheClass z2; |
||||
|
||||
public class TheClass { } |
||||
public class TheClass<T> {} |
||||
} |
||||
";
|
||||
MemberResolveResult rr = Resolve<MemberResolveResult>(program, "x1", 3); |
||||
Assert.AreEqual(1, rr.ResolvedType.GetUnderlyingClass().TypeParameters.Count); |
||||
|
||||
rr = Resolve<MemberResolveResult>(program, "y1", 3); |
||||
Assert.AreEqual(1, rr.ResolvedType.GetUnderlyingClass().TypeParameters.Count); |
||||
|
||||
rr = Resolve<MemberResolveResult>(program, "z1", 3); |
||||
Assert.AreEqual(1, rr.ResolvedType.GetUnderlyingClass().TypeParameters.Count); |
||||
|
||||
rr = Resolve<MemberResolveResult>(program, "x2", 3); |
||||
Assert.AreEqual(0, rr.ResolvedType.GetUnderlyingClass().TypeParameters.Count); |
||||
|
||||
rr = Resolve<MemberResolveResult>(program, "y2", 3); |
||||
Assert.AreEqual(0, rr.ResolvedType.GetUnderlyingClass().TypeParameters.Count); |
||||
|
||||
rr = Resolve<MemberResolveResult>(program, "z2", 3); |
||||
Assert.AreEqual(0, rr.ResolvedType.GetUnderlyingClass().TypeParameters.Count); |
||||
} |
||||
|
||||
[Test] |
||||
public void SimpleInnerClassInStruct() |
||||
{ |
||||
string program = @"struct A {
|
||||
void Test() { |
||||
|
||||
} |
||||
class B { } |
||||
} |
||||
";
|
||||
ResolveResult result = Resolve(program, "B", 3); |
||||
Assert.IsTrue(result is TypeResolveResult); |
||||
Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections;
|
||||
//using System.Collections.Generic;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// [TestFixture]
|
||||
// public class InnerClassesResolverTests
|
||||
// {
|
||||
// #region Test helper methods
|
||||
// NRefactoryResolverTests nrrt = new NRefactoryResolverTests();
|
||||
//
|
||||
// ResolveResult Resolve(string program, string expression, int line)
|
||||
// {
|
||||
// return nrrt.Resolve(program, expression, line);
|
||||
// }
|
||||
//
|
||||
// T Resolve<T>(string program, string expression, int line) where T : ResolveResult
|
||||
// {
|
||||
// return nrrt.Resolve<T>(program, expression, line);
|
||||
// }
|
||||
//
|
||||
// T ResolveVB<T>(string program, string expression, int line) where T : ResolveResult
|
||||
// {
|
||||
// return nrrt.ResolveVB<T>(program, expression, line);
|
||||
// }
|
||||
//
|
||||
// List<ICompletionEntry> CtrlSpace(string program, int line)
|
||||
// {
|
||||
// return nrrt.CtrlSpaceResolveCSharp(program, line, ExpressionContext.Default);
|
||||
// }
|
||||
// #endregion
|
||||
//
|
||||
// #region Ctrl-Space tests
|
||||
// [Test]
|
||||
// public void CtrlSpaceIncludesInnerClass()
|
||||
// {
|
||||
// string program = @"class A {
|
||||
// class Inner { }
|
||||
//
|
||||
// }";
|
||||
// Assert.IsTrue(IsInnerClassVisible(CtrlSpace(program, 3)));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void CtrlSpaceIncludesInheritedInnerClass()
|
||||
// {
|
||||
// string program = @"class A : Outer {
|
||||
//
|
||||
// }
|
||||
// class Outer { protected class Inner { } }
|
||||
//";
|
||||
// Assert.IsTrue(IsInnerClassVisible(CtrlSpace(program, 2)));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void CtrlSpaceDoesNotIncludeInheritedPrivateInnerClass()
|
||||
// {
|
||||
// string program = @"class A : Outer {
|
||||
//
|
||||
// }
|
||||
// class Outer { class Inner { } }
|
||||
//";
|
||||
// Assert.IsFalse(IsInnerClassVisible(CtrlSpace(program, 2)));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void CtrlSpaceIncludesInnerClassFromOtherPart()
|
||||
// {
|
||||
// string program = @"partial class A {
|
||||
//
|
||||
// }
|
||||
// partial class A { class Inner { } }
|
||||
//";
|
||||
// Assert.IsTrue(IsInnerClassVisible(CtrlSpace(program, 2)));
|
||||
// }
|
||||
// #endregion
|
||||
//
|
||||
// [Test]
|
||||
// public void InnerClassTest()
|
||||
// {
|
||||
// string program = @"using System;
|
||||
//class A {
|
||||
//
|
||||
//}
|
||||
//";
|
||||
// ResolveResult result = Resolve<TypeResolveResult>(program, "Environment.SpecialFolder", 3);
|
||||
// Assert.AreEqual("System.Environment.SpecialFolder", result.ResolvedType.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SimpleInnerClass()
|
||||
// {
|
||||
// string program = @"class A {
|
||||
// void Test() {
|
||||
//
|
||||
// }
|
||||
// class B { }
|
||||
//}
|
||||
//";
|
||||
// ResolveResult result = Resolve(program, "B", 3);
|
||||
// Assert.IsTrue(result is TypeResolveResult);
|
||||
// Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void InnerClassWithStaticFieldOfSameType()
|
||||
// {
|
||||
// string program = @"class A {
|
||||
// void Test() {
|
||||
//
|
||||
// }
|
||||
// class B {
|
||||
// public static B Instance;
|
||||
// }
|
||||
//}
|
||||
//";
|
||||
// ResolveResult result = Resolve(program, "B.Instance", 3);
|
||||
// Assert.IsTrue(result is MemberResolveResult);
|
||||
// Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void InnerClassWithStaticFieldOfSameTypeInPartialClass1()
|
||||
// {
|
||||
// string program = @"partial class A {
|
||||
// void Test() {
|
||||
//
|
||||
// }
|
||||
//}
|
||||
//partial class A {
|
||||
// class B {
|
||||
// public static B Instance;
|
||||
// }
|
||||
//}
|
||||
//";
|
||||
// ResolveResult result = Resolve(program, "B.Instance", 3);
|
||||
// Assert.IsTrue(result is MemberResolveResult);
|
||||
// Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void InnerClassWithStaticFieldOfSameTypeInPartialClass2()
|
||||
// {
|
||||
// string program = @"partial class A {
|
||||
// void Test() {
|
||||
//
|
||||
// }
|
||||
// class B {
|
||||
// public static B Instance;
|
||||
// }
|
||||
//}
|
||||
//partial class A {
|
||||
//}
|
||||
//";
|
||||
// ResolveResult result = Resolve(program, "B.Instance", 3);
|
||||
// Assert.IsTrue(result is MemberResolveResult);
|
||||
// Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ReflectionInnerClass()
|
||||
// {
|
||||
// string program = @"using System;
|
||||
//class A {
|
||||
// void Test() {
|
||||
//
|
||||
// }
|
||||
//}
|
||||
//";
|
||||
// ResolveResult result = Resolve(program, "Environment.SpecialFolder", 3);
|
||||
// Assert.IsTrue(result is TypeResolveResult);
|
||||
// Assert.AreEqual("System.Environment.SpecialFolder", result.ResolvedType.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OuterclassPrivateFieldCtrlSpaceTest()
|
||||
// {
|
||||
// string program = @"class A
|
||||
//{
|
||||
// int myField;
|
||||
// class B
|
||||
// {
|
||||
// void MyMethod(A a)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//";
|
||||
// ResolveResult result = Resolve(program, "a", 8);
|
||||
// Assert.IsNotNull(result, "result");
|
||||
// Assert.IsTrue(result is LocalResolveResult, "result is LocalResolveResult");
|
||||
// var arr = result.GetCompletionData(nrrt.lastPC);
|
||||
// Assert.IsNotNull(arr, "arr");
|
||||
// foreach (object o in arr) {
|
||||
// if (o is IField) {
|
||||
// Assert.AreEqual("myField", ((IField)o).Name);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// Assert.Fail("private field not visible from inner class");
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OuterclassStaticFieldResolveTest()
|
||||
// {
|
||||
// string program = @"class A
|
||||
//{
|
||||
// static int myField;
|
||||
// class B
|
||||
// {
|
||||
// void MyMethod()
|
||||
// {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//";
|
||||
// MemberResolveResult result = Resolve<MemberResolveResult>(program, "myField", 8);
|
||||
// Assert.AreEqual("A.myField", result.ResolvedMember.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OuterclassStaticMethodCallResolveTest()
|
||||
// {
|
||||
// string program = @"class A
|
||||
//{
|
||||
// static void Test(int arg);
|
||||
// class B
|
||||
// {
|
||||
// void MyMethod()
|
||||
// {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//";
|
||||
// MemberResolveResult result = Resolve<MemberResolveResult>(program, "Test(4)", 8);
|
||||
// Assert.AreEqual("A.Test", result.ResolvedMember.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void InheritedInnerClass()
|
||||
// {
|
||||
// string program = @"class A {
|
||||
// protected class B { }
|
||||
//}
|
||||
//class C : A {
|
||||
// void Main() {
|
||||
//
|
||||
// }
|
||||
//}
|
||||
//";
|
||||
// ResolveResult result = Resolve(program, "B", 6);
|
||||
// Assert.IsTrue(result is TypeResolveResult);
|
||||
// Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName);
|
||||
//
|
||||
// result = Resolve(program, "C.B", 6);
|
||||
// Assert.IsTrue(result is TypeResolveResult);
|
||||
// Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName);
|
||||
//
|
||||
// result = Resolve(program, "C", 6);
|
||||
// Assert.IsTrue(result is TypeResolveResult);
|
||||
// Assert.AreEqual("C", result.ResolvedType.FullyQualifiedName);
|
||||
// foreach (object o in result.GetCompletionData(nrrt.lastPC)) {
|
||||
// if (o is IClass) {
|
||||
// Assert.AreEqual("A.B", ((IClass)o).FullyQualifiedName);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// Assert.Fail("Inherited inner class not visible.");
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void NestedClassHidingHidesAllMethods()
|
||||
// {
|
||||
// string program = @"using System;
|
||||
//class A {
|
||||
// static void Test(int arg) {}
|
||||
// static void Test(string arg) {}
|
||||
// class B {
|
||||
// void MyMethod() {
|
||||
//
|
||||
// }
|
||||
// static void Test(long arg) {}
|
||||
// }
|
||||
//}";
|
||||
// MemberResolveResult result = Resolve<MemberResolveResult>(program, "Test(4)", 7);
|
||||
// Assert.AreEqual("A.B.Test", result.ResolvedMember.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void NestedInnerClasses()
|
||||
// {
|
||||
// string program = @"using System;
|
||||
//public sealed class GL {
|
||||
// void Test() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public class Enums
|
||||
// {
|
||||
// public enum BeginMode {QUADS, LINES }
|
||||
// }
|
||||
//}
|
||||
//";
|
||||
// TypeResolveResult trr = Resolve<TypeResolveResult>(program, "GL.Enums.BeginMode", 4);
|
||||
// Assert.AreEqual("GL.Enums.BeginMode", trr.ResolvedClass.FullyQualifiedName);
|
||||
//
|
||||
// trr = Resolve<TypeResolveResult>(program, "Enums.BeginMode", 4);
|
||||
// Assert.AreEqual("GL.Enums.BeginMode", trr.ResolvedClass.FullyQualifiedName);
|
||||
//
|
||||
// MemberResolveResult mrr = Resolve<MemberResolveResult>(program, "GL.Enums.BeginMode.LINES", 4);
|
||||
// Assert.AreEqual("GL.Enums.BeginMode.LINES", mrr.ResolvedMember.FullyQualifiedName);
|
||||
//
|
||||
// mrr = Resolve<MemberResolveResult>(program, "Enums.BeginMode.LINES", 4);
|
||||
// Assert.AreEqual("GL.Enums.BeginMode.LINES", mrr.ResolvedMember.FullyQualifiedName);
|
||||
//
|
||||
// // ensure that GetClass works correctly:
|
||||
// IClass c = trr.ResolvedClass.ProjectContent.GetClass("GL.Enums.BeginMode", 0);
|
||||
// Assert.IsNotNull(c);
|
||||
// Assert.AreEqual("GL.Enums.BeginMode", c.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void DoNotShowInaccessibleInnerClass()
|
||||
// {
|
||||
// string program = @"using System;
|
||||
//class C {
|
||||
//
|
||||
//}
|
||||
//class Outer { private class Inner { } }
|
||||
//";
|
||||
// TypeResolveResult trr = Resolve<TypeResolveResult>(program, "Outer", 3);
|
||||
// var l = trr.GetCompletionData(trr.ResolvedClass.ProjectContent);
|
||||
// Assert.IsFalse(IsInnerClassVisible(l));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ShowProtectedInnerClassFromDerivedClass()
|
||||
// {
|
||||
// string program = @"using System;
|
||||
//class Derived : Outer {
|
||||
//
|
||||
//}
|
||||
//class Outer { protected class Inner {} }
|
||||
//";
|
||||
// TypeResolveResult trr = Resolve<TypeResolveResult>(program, "Outer", 3);
|
||||
// var l = trr.GetCompletionData(trr.ResolvedClass.ProjectContent);
|
||||
// Assert.IsTrue(IsInnerClassVisible(l));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ShowProtectedInnerClassThroughForeignDerivedClass()
|
||||
// {
|
||||
// string program = @"using System;
|
||||
//class Derived : Outer {
|
||||
//
|
||||
//}
|
||||
//class Derived2 : Outer { }
|
||||
//class Outer { protected class Inner {} }
|
||||
//";
|
||||
// TypeResolveResult trr = Resolve<TypeResolveResult>(program, "Derived2", 3);
|
||||
// var l = trr.GetCompletionData(trr.ResolvedClass.ProjectContent);
|
||||
// Assert.IsTrue(IsInnerClassVisible(l));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void DoNotShowProtectedInnerClassThroughUnrelatedClass()
|
||||
// {
|
||||
// string program = @"using System;
|
||||
//class Unrelated {
|
||||
//
|
||||
//}
|
||||
//class Derived : Outer { }
|
||||
//class Outer { protected class Inner {} }
|
||||
//";
|
||||
// TypeResolveResult trr = Resolve<TypeResolveResult>(program, "Derived", 3);
|
||||
// var l = trr.GetCompletionData(trr.ResolvedClass.ProjectContent);
|
||||
// Assert.IsFalse(IsInnerClassVisible(l));
|
||||
// }
|
||||
//
|
||||
// bool IsInnerClassVisible(IEnumerable l)
|
||||
// {
|
||||
// foreach (object o in l) {
|
||||
// IClass c = o as IClass;
|
||||
// if (c != null && c.Name == "Inner")
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GenericInnerClassOrNonGenericOuterClass()
|
||||
// {
|
||||
// string program = @"using System;
|
||||
//class Test {
|
||||
//
|
||||
// class TheClass<T> {}
|
||||
//}
|
||||
//class TheClass { }
|
||||
//";
|
||||
// TypeResolveResult trr = Resolve<TypeResolveResult>(program, "TheClass<string>", 3);
|
||||
// Assert.AreEqual("Test.TheClass", trr.ResolvedClass.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GenericInnerClassOrNonGenericOuterClass2()
|
||||
// {
|
||||
// string program = @"using System;
|
||||
//class Test {
|
||||
// TheClass<string> x;
|
||||
//
|
||||
// class TheClass<T> {}
|
||||
//}
|
||||
//class TheClass { }
|
||||
//";
|
||||
// MemberResolveResult rr = Resolve<MemberResolveResult>(program, "x", 3);
|
||||
// Assert.AreEqual("Test.TheClass", rr.ResolvedType.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GenericInnerClassOrNonGenericInnerClass()
|
||||
// {
|
||||
// string program = @"using System;
|
||||
//class Test {
|
||||
// TheClass<string> x1;
|
||||
// TheClass x2;
|
||||
// Test.TheClass<string> y1;
|
||||
// Test.TheClass y2;
|
||||
// global::Test.TheClass<string> z1;
|
||||
// global::Test.TheClass z2;
|
||||
//
|
||||
// public class TheClass { }
|
||||
// public class TheClass<T> {}
|
||||
//}
|
||||
//";
|
||||
// MemberResolveResult rr = Resolve<MemberResolveResult>(program, "x1", 3);
|
||||
// Assert.AreEqual(1, rr.ResolvedType.GetUnderlyingClass().TypeParameters.Count);
|
||||
//
|
||||
// rr = Resolve<MemberResolveResult>(program, "y1", 3);
|
||||
// Assert.AreEqual(1, rr.ResolvedType.GetUnderlyingClass().TypeParameters.Count);
|
||||
//
|
||||
// rr = Resolve<MemberResolveResult>(program, "z1", 3);
|
||||
// Assert.AreEqual(1, rr.ResolvedType.GetUnderlyingClass().TypeParameters.Count);
|
||||
//
|
||||
// rr = Resolve<MemberResolveResult>(program, "x2", 3);
|
||||
// Assert.AreEqual(0, rr.ResolvedType.GetUnderlyingClass().TypeParameters.Count);
|
||||
//
|
||||
// rr = Resolve<MemberResolveResult>(program, "y2", 3);
|
||||
// Assert.AreEqual(0, rr.ResolvedType.GetUnderlyingClass().TypeParameters.Count);
|
||||
//
|
||||
// rr = Resolve<MemberResolveResult>(program, "z2", 3);
|
||||
// Assert.AreEqual(0, rr.ResolvedType.GetUnderlyingClass().TypeParameters.Count);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SimpleInnerClassInStruct()
|
||||
// {
|
||||
// string program = @"struct A {
|
||||
// void Test() {
|
||||
//
|
||||
// }
|
||||
// class B { }
|
||||
//}
|
||||
//";
|
||||
// ResolveResult result = Resolve(program, "B", 3);
|
||||
// Assert.IsTrue(result is TypeResolveResult);
|
||||
// Assert.AreEqual("A.B", result.ResolvedType.FullyQualifiedName);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,441 +1,442 @@
@@ -1,441 +1,442 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class MemberLookupHelperTests |
||||
{ |
||||
IProjectContent msc; // = ProjectContentRegistry.Mscorlib;
|
||||
IProjectContent swf; // = ProjectContentRegistry.GetProjectContentForReference("System.Windows.Forms", "System.Windows.Forms");
|
||||
DefaultClass dummyClass; |
||||
IMethod methodForGenericCalls; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void FixtureSetup() |
||||
{ |
||||
ProjectContentRegistry r = new ProjectContentRegistry(); |
||||
msc = r.Mscorlib; |
||||
swf = r.GetProjectContentForReference("System.Windows.Forms", "System.Windows.Forms"); |
||||
|
||||
DefaultProjectContent dpc = new DefaultProjectContent(); |
||||
dpc.ReferencedContents.Add(msc); |
||||
DefaultCompilationUnit cu = new DefaultCompilationUnit(dpc); |
||||
dummyClass = new DefaultClass(cu, "DummyClass"); |
||||
cu.Classes.Add(dummyClass); |
||||
methodForGenericCalls = new DefaultMethod(dummyClass, "DummyMethod"); |
||||
dummyClass.Methods.Add(methodForGenericCalls); |
||||
} |
||||
|
||||
IReturnType DictionaryRT { |
||||
get { |
||||
return new GetClassReturnType(msc, "System.Collections.Generic.Dictionary", 2); |
||||
} |
||||
} |
||||
|
||||
IClass EnumerableClass { |
||||
get { |
||||
return msc.GetClass("System.Collections.Generic.IEnumerable", 1); |
||||
} |
||||
} |
||||
|
||||
ConstructedReturnType EnumerableOf(IReturnType element) |
||||
{ |
||||
return new ConstructedReturnType(EnumerableClass.DefaultReturnType, new IReturnType[] { element }); |
||||
} |
||||
|
||||
ConstructedReturnType IListOf(IReturnType element) |
||||
{ |
||||
return new ConstructedReturnType(msc.GetClass("System.Collections.Generic.IList", 1).DefaultReturnType, new IReturnType[] { element }); |
||||
} |
||||
|
||||
ConstructedReturnType ListOf(IReturnType element) |
||||
{ |
||||
return new ConstructedReturnType(msc.GetClass("System.Collections.Generic.List", 1).DefaultReturnType, new IReturnType[] { element }); |
||||
} |
||||
|
||||
[Test] |
||||
public void TypeParameterPassedToBaseClassTestDictionary() |
||||
{ |
||||
IReturnType[] stringInt = { msc.SystemTypes.String, msc.SystemTypes.Int32 }; |
||||
IReturnType rrt = new ConstructedReturnType(DictionaryRT, stringInt); |
||||
IReturnType res = MemberLookupHelper.GetTypeParameterPassedToBaseClass(rrt, EnumerableClass, 0); |
||||
Assert.AreEqual("System.Collections.Generic.KeyValuePair", res.FullyQualifiedName); |
||||
ConstructedReturnType resc = res.CastToConstructedReturnType(); |
||||
Assert.AreEqual("System.String", resc.TypeArguments[0].FullyQualifiedName); |
||||
Assert.AreEqual("System.Int32", resc.TypeArguments[1].FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void TypeParameterPassedToBaseClassTestString() |
||||
{ |
||||
IReturnType res = MemberLookupHelper.GetTypeParameterPassedToBaseClass(msc.SystemTypes.String, EnumerableClass, 0); |
||||
Assert.AreEqual("System.Char", res.FullyQualifiedName); |
||||
} |
||||
|
||||
DefaultClass CreateClassDerivingFromListOfString() |
||||
{ |
||||
DefaultProjectContent dpc = new DefaultProjectContent(); |
||||
dpc.ReferencedContents.Add(msc); |
||||
DefaultCompilationUnit cu = new DefaultCompilationUnit(dpc); |
||||
cu.UsingScope.Usings.Add(new DefaultUsing(dpc, new DomRegion(1,1, 5,5))); |
||||
cu.UsingScope.Usings[0].Usings.Add("System.Collections.Generic"); |
||||
|
||||
DefaultClass listDerivingClass = new DefaultClass(cu, "DerivesFromList"); |
||||
cu.Classes.Add(listDerivingClass); |
||||
listDerivingClass.BaseTypes.Add(new ConstructedReturnType(new SearchClassReturnType(dpc, listDerivingClass, 3, 1, |
||||
"List", 1), |
||||
new IReturnType[] { |
||||
new GetClassReturnType(dpc, "System.String", 0) |
||||
})); |
||||
|
||||
return listDerivingClass; |
||||
} |
||||
|
||||
DefaultClass CreateGenericClassDerivingFromList() |
||||
{ |
||||
DefaultProjectContent dpc = new DefaultProjectContent(); |
||||
dpc.ReferencedContents.Add(msc); |
||||
DefaultCompilationUnit cu = new DefaultCompilationUnit(dpc); |
||||
cu.UsingScope.Usings.Add(new DefaultUsing(dpc, new DomRegion(1,1, 5,5))); |
||||
cu.UsingScope.Usings[0].Usings.Add("System.Collections.Generic"); |
||||
|
||||
DefaultClass listDerivingClass = new DefaultClass(cu, "DerivesFromList"); |
||||
cu.Classes.Add(listDerivingClass); |
||||
listDerivingClass.TypeParameters.Add(new DefaultTypeParameter(listDerivingClass, "T", 0)); |
||||
listDerivingClass.BaseTypes.Add(new ConstructedReturnType(new SearchClassReturnType(dpc, listDerivingClass, 3, 1, |
||||
"List", 1), |
||||
new IReturnType[] { |
||||
new GenericReturnType(listDerivingClass.TypeParameters[0]) |
||||
})); |
||||
return listDerivingClass; |
||||
} |
||||
|
||||
[Test] |
||||
public void TypeParameterPassedToBaseClassTestClassDerivingFromList() |
||||
{ |
||||
DefaultClass listDerivingClass = CreateClassDerivingFromListOfString(); |
||||
|
||||
IReturnType res = MemberLookupHelper.GetTypeParameterPassedToBaseClass(listDerivingClass.DefaultReturnType, |
||||
EnumerableClass, 0); |
||||
Assert.AreEqual("System.String", res.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void TypeParameterPassedToBaseClassTestGenericClassDerivingFromList() |
||||
{ |
||||
DefaultClass listDerivingClass = CreateGenericClassDerivingFromList(); |
||||
|
||||
ConstructedReturnType testType = new ConstructedReturnType(listDerivingClass.DefaultReturnType, |
||||
new IReturnType[] { msc.SystemTypes.String }); |
||||
|
||||
IReturnType res = MemberLookupHelper.GetTypeParameterPassedToBaseClass(testType, |
||||
EnumerableClass, 0); |
||||
Assert.AreEqual("System.String", res.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void TypeParameterPassedToBaseClassSameClass() |
||||
{ |
||||
IReturnType[] stringArr = { msc.SystemTypes.String }; |
||||
IReturnType rrt = new ConstructedReturnType(EnumerableClass.DefaultReturnType, stringArr); |
||||
IReturnType res = MemberLookupHelper.GetTypeParameterPassedToBaseClass(rrt, EnumerableClass, 0); |
||||
Assert.AreEqual("System.String", res.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetCommonType() |
||||
{ |
||||
IReturnType res = MemberLookupHelper.GetCommonType(msc, |
||||
swf.GetClass("System.Windows.Forms.ToolStripButton", 0).DefaultReturnType, |
||||
swf.GetClass("System.Windows.Forms.ToolStripSeparator", 0).DefaultReturnType); |
||||
Assert.AreEqual("System.Windows.Forms.ToolStripItem", res.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetCommonTypeOfStringAndNull() |
||||
{ |
||||
IReturnType res = MemberLookupHelper.GetCommonType(msc, |
||||
msc.GetClass("System.String", 0).DefaultReturnType, |
||||
NullReturnType.Instance); |
||||
Assert.AreEqual("System.String", res.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetCommonTypeOfNullAndString() |
||||
{ |
||||
IReturnType res = MemberLookupHelper.GetCommonType(msc, |
||||
NullReturnType.Instance, |
||||
msc.GetClass("System.String", 0).DefaultReturnType); |
||||
Assert.AreEqual("System.String", res.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetTypeInheritanceTreeOfClassDerivingFromListOfString() |
||||
{ |
||||
List<string> results = new List<IReturnType>( |
||||
MemberLookupHelper.GetTypeInheritanceTree(CreateClassDerivingFromListOfString().DefaultReturnType) |
||||
).ConvertAll<string>(delegate (IReturnType rt) { return rt.DotNetName; }); |
||||
|
||||
results.Sort(); // order is not guaranteed, so sort for the unit test
|
||||
|
||||
Assert.AreEqual("DerivesFromList;" + |
||||
"System.Collections.Generic.ICollection{System.String};" + |
||||
"System.Collections.Generic.IEnumerable{System.String};" + |
||||
"System.Collections.Generic.IList{System.String};" + |
||||
"System.Collections.Generic.List{System.String};" + |
||||
"System.Collections.ICollection;" + |
||||
"System.Collections.IEnumerable;" + |
||||
"System.Collections.IList;" + |
||||
"System.Object", |
||||
string.Join(";", results.ToArray())); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetTypeInheritanceTreeOfStringArray() |
||||
{ |
||||
List<string> results = new List<IReturnType>( |
||||
MemberLookupHelper.GetTypeInheritanceTree(new ArrayReturnType(msc, msc.SystemTypes.String, 1)) |
||||
).ConvertAll<string>(delegate (IReturnType rt) { return rt.DotNetName; }); |
||||
|
||||
results.Sort(); // order is not guaranteed, so sort for the unit test
|
||||
|
||||
Assert.AreEqual("System.Collections.Generic.ICollection{System.String};" + |
||||
"System.Collections.Generic.IEnumerable{System.String};" + |
||||
"System.Collections.Generic.IList{System.String};" + |
||||
"System.Collections.ICollection;" + |
||||
"System.Collections.IEnumerable;" + |
||||
"System.Collections.IList;" + |
||||
"System.Object;" + |
||||
"System.String[]", |
||||
string.Join(";", results.ToArray())); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConversionExistsFromStringArrayToObjectArray() |
||||
{ |
||||
Assert.IsTrue(MemberLookupHelper.ConversionExists(new ArrayReturnType(msc, msc.SystemTypes.String, 1), |
||||
new ArrayReturnType(msc, msc.SystemTypes.Object, 1))); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoConversionExistsFromObjectArrayToStringArray() |
||||
{ |
||||
Assert.IsFalse(MemberLookupHelper.ConversionExists(new ArrayReturnType(msc, msc.SystemTypes.Object, 1), |
||||
new ArrayReturnType(msc, msc.SystemTypes.String, 1))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConversionExistsFromStringArrayToStringEnumerable() |
||||
{ |
||||
Assert.IsTrue(MemberLookupHelper.ConversionExists(new ArrayReturnType(msc, msc.SystemTypes.String, 1), |
||||
EnumerableOf(msc.SystemTypes.String))); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoConversionExistsFromStringEnumerableToObjectEnumerable() |
||||
{ |
||||
Assert.IsFalse(MemberLookupHelper.ConversionExists(EnumerableOf(msc.SystemTypes.String), |
||||
EnumerableOf(msc.SystemTypes.Object))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConversionExistsFromStringIListToStringEnumerable() |
||||
{ |
||||
Assert.IsTrue(MemberLookupHelper.ConversionExists(IListOf(msc.SystemTypes.String), |
||||
EnumerableOf(msc.SystemTypes.String))); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoConversionExistsFromStringIListToIntEnumerable() |
||||
{ |
||||
Assert.IsFalse(MemberLookupHelper.ConversionExists(IListOf(msc.SystemTypes.String), |
||||
EnumerableOf(msc.SystemTypes.Int32))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConversionExistsFromStringListToStringEnumerable() |
||||
{ |
||||
Assert.IsTrue(MemberLookupHelper.ConversionExists(ListOf(msc.SystemTypes.String), |
||||
EnumerableOf(msc.SystemTypes.String))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConversionExistsFromClassDerivingFromListOfStringToStringEnumerable() |
||||
{ |
||||
Assert.IsTrue(MemberLookupHelper.ConversionExists(CreateClassDerivingFromListOfString().DefaultReturnType, |
||||
EnumerableOf(msc.SystemTypes.String))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConversionExistsFromClassDerivingFromListOfStringToListOfString() |
||||
{ |
||||
Assert.IsTrue(MemberLookupHelper.ConversionExists(CreateClassDerivingFromListOfString().DefaultReturnType, |
||||
ListOf(msc.SystemTypes.String))); |
||||
} |
||||
|
||||
bool IsApplicable(IReturnType argument, IReturnType expected) |
||||
{ |
||||
return MemberLookupHelper.IsApplicable(argument, expected, methodForGenericCalls); |
||||
} |
||||
|
||||
GenericReturnType CreateT() |
||||
{ |
||||
ITypeParameter tp = new DefaultTypeParameter(methodForGenericCalls, "T", 0); |
||||
return new GenericReturnType(tp); |
||||
} |
||||
|
||||
GenericReturnType CreateTWithDisposableConstraint() |
||||
{ |
||||
GenericReturnType rt = CreateT(); |
||||
rt.TypeParameter.Constraints.Add(msc.GetClass("System.IDisposable", 0).DefaultReturnType); |
||||
return rt; |
||||
} |
||||
|
||||
[Test] |
||||
public void StringIsApplicableOnT() |
||||
{ |
||||
// no conversion exists
|
||||
Assert.IsFalse(MemberLookupHelper.ConversionExists(msc.SystemTypes.String, |
||||
CreateT())); |
||||
|
||||
// but it is applicable
|
||||
Assert.IsTrue(IsApplicable(msc.SystemTypes.String, |
||||
CreateT())); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoConversionExistsFromStringToDisposableT() |
||||
{ |
||||
// no conversion exists
|
||||
Assert.IsFalse(MemberLookupHelper.ConversionExists(msc.SystemTypes.String, |
||||
CreateTWithDisposableConstraint())); |
||||
|
||||
// but it is applicable (applicability ignores constraints)
|
||||
Assert.IsTrue(IsApplicable(msc.SystemTypes.String, |
||||
CreateTWithDisposableConstraint())); |
||||
} |
||||
|
||||
[Test] |
||||
public void DisposableClassIsApplicableOnDisposableT() |
||||
{ |
||||
Assert.IsFalse(MemberLookupHelper.ConversionExists(msc.GetClass("System.CharEnumerator", 0).DefaultReturnType, |
||||
CreateTWithDisposableConstraint())); |
||||
|
||||
Assert.IsTrue(IsApplicable(msc.GetClass("System.CharEnumerator", 0).DefaultReturnType, |
||||
CreateTWithDisposableConstraint())); |
||||
} |
||||
|
||||
[Test] |
||||
public void ListOfStringIsApplicableOnListOfT() |
||||
{ |
||||
Assert.IsTrue(IsApplicable(ListOf(msc.SystemTypes.String), |
||||
ListOf(CreateT()))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ListOfStringIsApplicableOnIEnumerableOfT() |
||||
{ |
||||
Assert.IsTrue(IsApplicable(ListOf(msc.SystemTypes.String), |
||||
EnumerableOf(CreateT()))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ArrayOfStringIsApplicableOnIListOfT() |
||||
{ |
||||
Assert.IsTrue(IsApplicable(new ArrayReturnType(msc, msc.SystemTypes.String, 1), |
||||
IListOf(CreateT()))); |
||||
|
||||
Assert.IsFalse(MemberLookupHelper.ConversionExists(new ArrayReturnType(msc, msc.SystemTypes.String, 1), |
||||
IListOf(CreateT()))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ArrayOfStringIsApplicableOnArrayOfT() |
||||
{ |
||||
Assert.IsTrue(IsApplicable(new ArrayReturnType(msc, msc.SystemTypes.String, 1), |
||||
new ArrayReturnType(msc, CreateT(), 1))); |
||||
|
||||
Assert.IsFalse(MemberLookupHelper.ConversionExists(new ArrayReturnType(msc, msc.SystemTypes.String, 1), |
||||
new ArrayReturnType(msc, CreateT(), 1))); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConversionExistsFromAnonymousDelegateToSystemPredicate() |
||||
{ |
||||
Assert.IsTrue(IsApplicable( |
||||
new AnonymousMethodReturnType(new DefaultCompilationUnit(msc)) { MethodReturnType = msc.SystemTypes.Boolean }, |
||||
new GetClassReturnType(msc, "System.Predicate", 1) |
||||
)); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoConversionExistsFromParameterlessAnonymousDelegateToSystemPredicate() |
||||
{ |
||||
AnonymousMethodReturnType amrt = new AnonymousMethodReturnType(new DefaultCompilationUnit(msc)); |
||||
amrt.MethodParameters = new List<IParameter>(); |
||||
Assert.IsFalse(MemberLookupHelper.ConversionExists( |
||||
amrt, |
||||
new GetClassReturnType(msc, "System.Predicate", 1) |
||||
)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConversionExistsFromAnonymousDelegateWithParameterToSystemPredicate() |
||||
{ |
||||
AnonymousMethodReturnType amrt = new AnonymousMethodReturnType(new DefaultCompilationUnit(msc)); |
||||
amrt.MethodReturnType = msc.SystemTypes.Boolean; |
||||
amrt.MethodParameters = new List<IParameter>(); |
||||
amrt.MethodParameters.Add(new DefaultParameter("test", msc.SystemTypes.String, DomRegion.Empty)); |
||||
Assert.IsTrue(MemberLookupHelper.ConversionExists( |
||||
amrt, |
||||
new ConstructedReturnType(new GetClassReturnType(msc, "System.Predicate", 1), |
||||
new IReturnType[] { msc.SystemTypes.String }) |
||||
)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConversionDoesNotExistFromAnonymousDelegateWithParameterToSystemPredicateWhenParameterTypeIsIncompatible() |
||||
{ |
||||
AnonymousMethodReturnType amrt = new AnonymousMethodReturnType(new DefaultCompilationUnit(msc)); |
||||
amrt.MethodReturnType = msc.SystemTypes.Boolean; |
||||
amrt.MethodParameters = new List<IParameter>(); |
||||
amrt.MethodParameters.Add(new DefaultParameter("test", msc.SystemTypes.String, DomRegion.Empty)); |
||||
Assert.IsFalse(MemberLookupHelper.ConversionExists( |
||||
amrt, |
||||
new ConstructedReturnType(new GetClassReturnType(msc, "System.Predicate", 1), |
||||
new IReturnType[] { msc.SystemTypes.Int32 }) |
||||
)); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetOverridableMethodsProperties() |
||||
{ |
||||
// get a class deriving from Form
|
||||
IClass form = swf.GetClass("System.Windows.Forms.PrintPreviewDialog", 0); |
||||
IMethod[] methods = OverrideCompletionItemProvider.GetOverridableMethods(form); |
||||
IProperty[] properties = OverrideCompletionItemProvider.GetOverridableProperties(form); |
||||
Assert.AreEqual(1, properties.Where(m=>m.Name=="AutoScroll").Count()); |
||||
Assert.AreEqual(1, properties.Where(m=>m.Name=="CanRaiseEvents").Count()); |
||||
Assert.AreEqual(1, methods.Where(m=>m.Name=="AdjustFormScrollbars").Count()); |
||||
} |
||||
|
||||
[Test] |
||||
public void LocalVariableAndFieldAreNotSimilarMembers() |
||||
{ |
||||
IField field = new DefaultField(dummyClass.DefaultReturnType, "Test", ModifierEnum.None, DomRegion.Empty, dummyClass); |
||||
IField local = new DefaultField.LocalVariableField(dummyClass.DefaultReturnType, "Test", DomRegion.Empty, dummyClass); |
||||
Assert.IsFalse(MemberLookupHelper.IsSimilarMember(local, field)); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Editor;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// [TestFixture]
|
||||
// public class MemberLookupHelperTests
|
||||
// {
|
||||
// IProjectContent msc; // = ProjectContentRegistry.Mscorlib;
|
||||
// IProjectContent swf; // = ProjectContentRegistry.GetProjectContentForReference("System.Windows.Forms", "System.Windows.Forms");
|
||||
// DefaultClass dummyClass;
|
||||
// IMethod methodForGenericCalls;
|
||||
//
|
||||
// [TestFixtureSetUp]
|
||||
// public void FixtureSetup()
|
||||
// {
|
||||
// ProjectContentRegistry r = new ProjectContentRegistry();
|
||||
// msc = r.Mscorlib;
|
||||
// swf = r.GetProjectContentForReference("System.Windows.Forms", "System.Windows.Forms");
|
||||
//
|
||||
// DefaultProjectContent dpc = new DefaultProjectContent();
|
||||
// dpc.ReferencedContents.Add(msc);
|
||||
// DefaultCompilationUnit cu = new DefaultCompilationUnit(dpc);
|
||||
// dummyClass = new DefaultClass(cu, "DummyClass");
|
||||
// cu.Classes.Add(dummyClass);
|
||||
// methodForGenericCalls = new DefaultMethod(dummyClass, "DummyMethod");
|
||||
// dummyClass.Methods.Add(methodForGenericCalls);
|
||||
// }
|
||||
//
|
||||
// IReturnType DictionaryRT {
|
||||
// get {
|
||||
// return new GetClassReturnType(msc, "System.Collections.Generic.Dictionary", 2);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// IClass EnumerableClass {
|
||||
// get {
|
||||
// return msc.GetClass("System.Collections.Generic.IEnumerable", 1);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// ConstructedReturnType EnumerableOf(IReturnType element)
|
||||
// {
|
||||
// return new ConstructedReturnType(EnumerableClass.DefaultReturnType, new IReturnType[] { element });
|
||||
// }
|
||||
//
|
||||
// ConstructedReturnType IListOf(IReturnType element)
|
||||
// {
|
||||
// return new ConstructedReturnType(msc.GetClass("System.Collections.Generic.IList", 1).DefaultReturnType, new IReturnType[] { element });
|
||||
// }
|
||||
//
|
||||
// ConstructedReturnType ListOf(IReturnType element)
|
||||
// {
|
||||
// return new ConstructedReturnType(msc.GetClass("System.Collections.Generic.List", 1).DefaultReturnType, new IReturnType[] { element });
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void TypeParameterPassedToBaseClassTestDictionary()
|
||||
// {
|
||||
// IReturnType[] stringInt = { msc.SystemTypes.String, msc.SystemTypes.Int32 };
|
||||
// IReturnType rrt = new ConstructedReturnType(DictionaryRT, stringInt);
|
||||
// IReturnType res = MemberLookupHelper.GetTypeParameterPassedToBaseClass(rrt, EnumerableClass, 0);
|
||||
// Assert.AreEqual("System.Collections.Generic.KeyValuePair", res.FullyQualifiedName);
|
||||
// ConstructedReturnType resc = res.CastToConstructedReturnType();
|
||||
// Assert.AreEqual("System.String", resc.TypeArguments[0].FullyQualifiedName);
|
||||
// Assert.AreEqual("System.Int32", resc.TypeArguments[1].FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void TypeParameterPassedToBaseClassTestString()
|
||||
// {
|
||||
// IReturnType res = MemberLookupHelper.GetTypeParameterPassedToBaseClass(msc.SystemTypes.String, EnumerableClass, 0);
|
||||
// Assert.AreEqual("System.Char", res.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// DefaultClass CreateClassDerivingFromListOfString()
|
||||
// {
|
||||
// DefaultProjectContent dpc = new DefaultProjectContent();
|
||||
// dpc.ReferencedContents.Add(msc);
|
||||
// DefaultCompilationUnit cu = new DefaultCompilationUnit(dpc);
|
||||
// cu.UsingScope.Usings.Add(new DefaultUsing(dpc, new DomRegion(1,1, 5,5)));
|
||||
// cu.UsingScope.Usings[0].Usings.Add("System.Collections.Generic");
|
||||
//
|
||||
// DefaultClass listDerivingClass = new DefaultClass(cu, "DerivesFromList");
|
||||
// cu.Classes.Add(listDerivingClass);
|
||||
// listDerivingClass.BaseTypes.Add(new ConstructedReturnType(new SearchClassReturnType(dpc, listDerivingClass, 3, 1,
|
||||
// "List", 1),
|
||||
// new IReturnType[] {
|
||||
// new GetClassReturnType(dpc, "System.String", 0)
|
||||
// }));
|
||||
//
|
||||
// return listDerivingClass;
|
||||
// }
|
||||
//
|
||||
// DefaultClass CreateGenericClassDerivingFromList()
|
||||
// {
|
||||
// DefaultProjectContent dpc = new DefaultProjectContent();
|
||||
// dpc.ReferencedContents.Add(msc);
|
||||
// DefaultCompilationUnit cu = new DefaultCompilationUnit(dpc);
|
||||
// cu.UsingScope.Usings.Add(new DefaultUsing(dpc, new DomRegion(1,1, 5,5)));
|
||||
// cu.UsingScope.Usings[0].Usings.Add("System.Collections.Generic");
|
||||
//
|
||||
// DefaultClass listDerivingClass = new DefaultClass(cu, "DerivesFromList");
|
||||
// cu.Classes.Add(listDerivingClass);
|
||||
// listDerivingClass.TypeParameters.Add(new DefaultTypeParameter(listDerivingClass, "T", 0));
|
||||
// listDerivingClass.BaseTypes.Add(new ConstructedReturnType(new SearchClassReturnType(dpc, listDerivingClass, 3, 1,
|
||||
// "List", 1),
|
||||
// new IReturnType[] {
|
||||
// new GenericReturnType(listDerivingClass.TypeParameters[0])
|
||||
// }));
|
||||
// return listDerivingClass;
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void TypeParameterPassedToBaseClassTestClassDerivingFromList()
|
||||
// {
|
||||
// DefaultClass listDerivingClass = CreateClassDerivingFromListOfString();
|
||||
//
|
||||
// IReturnType res = MemberLookupHelper.GetTypeParameterPassedToBaseClass(listDerivingClass.DefaultReturnType,
|
||||
// EnumerableClass, 0);
|
||||
// Assert.AreEqual("System.String", res.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void TypeParameterPassedToBaseClassTestGenericClassDerivingFromList()
|
||||
// {
|
||||
// DefaultClass listDerivingClass = CreateGenericClassDerivingFromList();
|
||||
//
|
||||
// ConstructedReturnType testType = new ConstructedReturnType(listDerivingClass.DefaultReturnType,
|
||||
// new IReturnType[] { msc.SystemTypes.String });
|
||||
//
|
||||
// IReturnType res = MemberLookupHelper.GetTypeParameterPassedToBaseClass(testType,
|
||||
// EnumerableClass, 0);
|
||||
// Assert.AreEqual("System.String", res.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void TypeParameterPassedToBaseClassSameClass()
|
||||
// {
|
||||
// IReturnType[] stringArr = { msc.SystemTypes.String };
|
||||
// IReturnType rrt = new ConstructedReturnType(EnumerableClass.DefaultReturnType, stringArr);
|
||||
// IReturnType res = MemberLookupHelper.GetTypeParameterPassedToBaseClass(rrt, EnumerableClass, 0);
|
||||
// Assert.AreEqual("System.String", res.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GetCommonType()
|
||||
// {
|
||||
// IReturnType res = MemberLookupHelper.GetCommonType(msc,
|
||||
// swf.GetClass("System.Windows.Forms.ToolStripButton", 0).DefaultReturnType,
|
||||
// swf.GetClass("System.Windows.Forms.ToolStripSeparator", 0).DefaultReturnType);
|
||||
// Assert.AreEqual("System.Windows.Forms.ToolStripItem", res.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GetCommonTypeOfStringAndNull()
|
||||
// {
|
||||
// IReturnType res = MemberLookupHelper.GetCommonType(msc,
|
||||
// msc.GetClass("System.String", 0).DefaultReturnType,
|
||||
// NullReturnType.Instance);
|
||||
// Assert.AreEqual("System.String", res.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GetCommonTypeOfNullAndString()
|
||||
// {
|
||||
// IReturnType res = MemberLookupHelper.GetCommonType(msc,
|
||||
// NullReturnType.Instance,
|
||||
// msc.GetClass("System.String", 0).DefaultReturnType);
|
||||
// Assert.AreEqual("System.String", res.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GetTypeInheritanceTreeOfClassDerivingFromListOfString()
|
||||
// {
|
||||
// List<string> results = new List<IReturnType>(
|
||||
// MemberLookupHelper.GetTypeInheritanceTree(CreateClassDerivingFromListOfString().DefaultReturnType)
|
||||
// ).ConvertAll<string>(delegate (IReturnType rt) { return rt.DotNetName; });
|
||||
//
|
||||
// results.Sort(); // order is not guaranteed, so sort for the unit test
|
||||
//
|
||||
// Assert.AreEqual("DerivesFromList;" +
|
||||
// "System.Collections.Generic.ICollection{System.String};" +
|
||||
// "System.Collections.Generic.IEnumerable{System.String};" +
|
||||
// "System.Collections.Generic.IList{System.String};" +
|
||||
// "System.Collections.Generic.List{System.String};" +
|
||||
// "System.Collections.ICollection;" +
|
||||
// "System.Collections.IEnumerable;" +
|
||||
// "System.Collections.IList;" +
|
||||
// "System.Object",
|
||||
// string.Join(";", results.ToArray()));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GetTypeInheritanceTreeOfStringArray()
|
||||
// {
|
||||
// List<string> results = new List<IReturnType>(
|
||||
// MemberLookupHelper.GetTypeInheritanceTree(new ArrayReturnType(msc, msc.SystemTypes.String, 1))
|
||||
// ).ConvertAll<string>(delegate (IReturnType rt) { return rt.DotNetName; });
|
||||
//
|
||||
// results.Sort(); // order is not guaranteed, so sort for the unit test
|
||||
//
|
||||
// Assert.AreEqual("System.Collections.Generic.ICollection{System.String};" +
|
||||
// "System.Collections.Generic.IEnumerable{System.String};" +
|
||||
// "System.Collections.Generic.IList{System.String};" +
|
||||
// "System.Collections.ICollection;" +
|
||||
// "System.Collections.IEnumerable;" +
|
||||
// "System.Collections.IList;" +
|
||||
// "System.Object;" +
|
||||
// "System.String[]",
|
||||
// string.Join(";", results.ToArray()));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConversionExistsFromStringArrayToObjectArray()
|
||||
// {
|
||||
// Assert.IsTrue(MemberLookupHelper.ConversionExists(new ArrayReturnType(msc, msc.SystemTypes.String, 1),
|
||||
// new ArrayReturnType(msc, msc.SystemTypes.Object, 1)));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void NoConversionExistsFromObjectArrayToStringArray()
|
||||
// {
|
||||
// Assert.IsFalse(MemberLookupHelper.ConversionExists(new ArrayReturnType(msc, msc.SystemTypes.Object, 1),
|
||||
// new ArrayReturnType(msc, msc.SystemTypes.String, 1)));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConversionExistsFromStringArrayToStringEnumerable()
|
||||
// {
|
||||
// Assert.IsTrue(MemberLookupHelper.ConversionExists(new ArrayReturnType(msc, msc.SystemTypes.String, 1),
|
||||
// EnumerableOf(msc.SystemTypes.String)));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void NoConversionExistsFromStringEnumerableToObjectEnumerable()
|
||||
// {
|
||||
// Assert.IsFalse(MemberLookupHelper.ConversionExists(EnumerableOf(msc.SystemTypes.String),
|
||||
// EnumerableOf(msc.SystemTypes.Object)));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConversionExistsFromStringIListToStringEnumerable()
|
||||
// {
|
||||
// Assert.IsTrue(MemberLookupHelper.ConversionExists(IListOf(msc.SystemTypes.String),
|
||||
// EnumerableOf(msc.SystemTypes.String)));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void NoConversionExistsFromStringIListToIntEnumerable()
|
||||
// {
|
||||
// Assert.IsFalse(MemberLookupHelper.ConversionExists(IListOf(msc.SystemTypes.String),
|
||||
// EnumerableOf(msc.SystemTypes.Int32)));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConversionExistsFromStringListToStringEnumerable()
|
||||
// {
|
||||
// Assert.IsTrue(MemberLookupHelper.ConversionExists(ListOf(msc.SystemTypes.String),
|
||||
// EnumerableOf(msc.SystemTypes.String)));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConversionExistsFromClassDerivingFromListOfStringToStringEnumerable()
|
||||
// {
|
||||
// Assert.IsTrue(MemberLookupHelper.ConversionExists(CreateClassDerivingFromListOfString().DefaultReturnType,
|
||||
// EnumerableOf(msc.SystemTypes.String)));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConversionExistsFromClassDerivingFromListOfStringToListOfString()
|
||||
// {
|
||||
// Assert.IsTrue(MemberLookupHelper.ConversionExists(CreateClassDerivingFromListOfString().DefaultReturnType,
|
||||
// ListOf(msc.SystemTypes.String)));
|
||||
// }
|
||||
//
|
||||
// bool IsApplicable(IReturnType argument, IReturnType expected)
|
||||
// {
|
||||
// return MemberLookupHelper.IsApplicable(argument, expected, methodForGenericCalls);
|
||||
// }
|
||||
//
|
||||
// GenericReturnType CreateT()
|
||||
// {
|
||||
// ITypeParameter tp = new DefaultTypeParameter(methodForGenericCalls, "T", 0);
|
||||
// return new GenericReturnType(tp);
|
||||
// }
|
||||
//
|
||||
// GenericReturnType CreateTWithDisposableConstraint()
|
||||
// {
|
||||
// GenericReturnType rt = CreateT();
|
||||
// rt.TypeParameter.Constraints.Add(msc.GetClass("System.IDisposable", 0).DefaultReturnType);
|
||||
// return rt;
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void StringIsApplicableOnT()
|
||||
// {
|
||||
// // no conversion exists
|
||||
// Assert.IsFalse(MemberLookupHelper.ConversionExists(msc.SystemTypes.String,
|
||||
// CreateT()));
|
||||
//
|
||||
// // but it is applicable
|
||||
// Assert.IsTrue(IsApplicable(msc.SystemTypes.String,
|
||||
// CreateT()));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void NoConversionExistsFromStringToDisposableT()
|
||||
// {
|
||||
// // no conversion exists
|
||||
// Assert.IsFalse(MemberLookupHelper.ConversionExists(msc.SystemTypes.String,
|
||||
// CreateTWithDisposableConstraint()));
|
||||
//
|
||||
// // but it is applicable (applicability ignores constraints)
|
||||
// Assert.IsTrue(IsApplicable(msc.SystemTypes.String,
|
||||
// CreateTWithDisposableConstraint()));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void DisposableClassIsApplicableOnDisposableT()
|
||||
// {
|
||||
// Assert.IsFalse(MemberLookupHelper.ConversionExists(msc.GetClass("System.CharEnumerator", 0).DefaultReturnType,
|
||||
// CreateTWithDisposableConstraint()));
|
||||
//
|
||||
// Assert.IsTrue(IsApplicable(msc.GetClass("System.CharEnumerator", 0).DefaultReturnType,
|
||||
// CreateTWithDisposableConstraint()));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ListOfStringIsApplicableOnListOfT()
|
||||
// {
|
||||
// Assert.IsTrue(IsApplicable(ListOf(msc.SystemTypes.String),
|
||||
// ListOf(CreateT())));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ListOfStringIsApplicableOnIEnumerableOfT()
|
||||
// {
|
||||
// Assert.IsTrue(IsApplicable(ListOf(msc.SystemTypes.String),
|
||||
// EnumerableOf(CreateT())));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ArrayOfStringIsApplicableOnIListOfT()
|
||||
// {
|
||||
// Assert.IsTrue(IsApplicable(new ArrayReturnType(msc, msc.SystemTypes.String, 1),
|
||||
// IListOf(CreateT())));
|
||||
//
|
||||
// Assert.IsFalse(MemberLookupHelper.ConversionExists(new ArrayReturnType(msc, msc.SystemTypes.String, 1),
|
||||
// IListOf(CreateT())));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ArrayOfStringIsApplicableOnArrayOfT()
|
||||
// {
|
||||
// Assert.IsTrue(IsApplicable(new ArrayReturnType(msc, msc.SystemTypes.String, 1),
|
||||
// new ArrayReturnType(msc, CreateT(), 1)));
|
||||
//
|
||||
// Assert.IsFalse(MemberLookupHelper.ConversionExists(new ArrayReturnType(msc, msc.SystemTypes.String, 1),
|
||||
// new ArrayReturnType(msc, CreateT(), 1)));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConversionExistsFromAnonymousDelegateToSystemPredicate()
|
||||
// {
|
||||
// Assert.IsTrue(IsApplicable(
|
||||
// new AnonymousMethodReturnType(new DefaultCompilationUnit(msc)) { MethodReturnType = msc.SystemTypes.Boolean },
|
||||
// new GetClassReturnType(msc, "System.Predicate", 1)
|
||||
// ));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void NoConversionExistsFromParameterlessAnonymousDelegateToSystemPredicate()
|
||||
// {
|
||||
// AnonymousMethodReturnType amrt = new AnonymousMethodReturnType(new DefaultCompilationUnit(msc));
|
||||
// amrt.MethodParameters = new List<IParameter>();
|
||||
// Assert.IsFalse(MemberLookupHelper.ConversionExists(
|
||||
// amrt,
|
||||
// new GetClassReturnType(msc, "System.Predicate", 1)
|
||||
// ));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConversionExistsFromAnonymousDelegateWithParameterToSystemPredicate()
|
||||
// {
|
||||
// AnonymousMethodReturnType amrt = new AnonymousMethodReturnType(new DefaultCompilationUnit(msc));
|
||||
// amrt.MethodReturnType = msc.SystemTypes.Boolean;
|
||||
// amrt.MethodParameters = new List<IParameter>();
|
||||
// amrt.MethodParameters.Add(new DefaultParameter("test", msc.SystemTypes.String, DomRegion.Empty));
|
||||
// Assert.IsTrue(MemberLookupHelper.ConversionExists(
|
||||
// amrt,
|
||||
// new ConstructedReturnType(new GetClassReturnType(msc, "System.Predicate", 1),
|
||||
// new IReturnType[] { msc.SystemTypes.String })
|
||||
// ));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConversionDoesNotExistFromAnonymousDelegateWithParameterToSystemPredicateWhenParameterTypeIsIncompatible()
|
||||
// {
|
||||
// AnonymousMethodReturnType amrt = new AnonymousMethodReturnType(new DefaultCompilationUnit(msc));
|
||||
// amrt.MethodReturnType = msc.SystemTypes.Boolean;
|
||||
// amrt.MethodParameters = new List<IParameter>();
|
||||
// amrt.MethodParameters.Add(new DefaultParameter("test", msc.SystemTypes.String, DomRegion.Empty));
|
||||
// Assert.IsFalse(MemberLookupHelper.ConversionExists(
|
||||
// amrt,
|
||||
// new ConstructedReturnType(new GetClassReturnType(msc, "System.Predicate", 1),
|
||||
// new IReturnType[] { msc.SystemTypes.Int32 })
|
||||
// ));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GetOverridableMethodsProperties()
|
||||
// {
|
||||
// // get a class deriving from Form
|
||||
// IClass form = swf.GetClass("System.Windows.Forms.PrintPreviewDialog", 0);
|
||||
// IMethod[] methods = OverrideCompletionItemProvider.GetOverridableMethods(form);
|
||||
// IProperty[] properties = OverrideCompletionItemProvider.GetOverridableProperties(form);
|
||||
// Assert.AreEqual(1, properties.Where(m=>m.Name=="AutoScroll").Count());
|
||||
// Assert.AreEqual(1, properties.Where(m=>m.Name=="CanRaiseEvents").Count());
|
||||
// Assert.AreEqual(1, methods.Where(m=>m.Name=="AdjustFormScrollbars").Count());
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void LocalVariableAndFieldAreNotSimilarMembers()
|
||||
// {
|
||||
// IField field = new DefaultField(dummyClass.DefaultReturnType, "Test", ModifierEnum.None, DomRegion.Empty, dummyClass);
|
||||
// IField local = new DefaultField.LocalVariableField(dummyClass.DefaultReturnType, "Test", DomRegion.Empty, dummyClass);
|
||||
// Assert.IsFalse(MemberLookupHelper.IsSimilarMember(local, field));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,149 +1,150 @@
@@ -1,149 +1,150 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Text; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class OverloadFinding |
||||
{ |
||||
[Test] public void Simple() |
||||
{ |
||||
Test("(\"Hallo\")", 0, "(string a)", "(int b)"); |
||||
Test("(2)", 1, "(string a)", "(int b)"); |
||||
} |
||||
|
||||
[Test] public void WinForms() |
||||
{ |
||||
string[] overloads = {"(object a)", "(TextBoxBase a)", "(Control a)", "(RichTextBox a)"}; |
||||
Test("(new RichTextBox())", 3, overloads); |
||||
Test("(new Control())", 2, overloads); |
||||
Test("(new TextBox())", 1, overloads); |
||||
Test("(new Button())", 2, overloads); |
||||
Test("(3)", 0, overloads); |
||||
} |
||||
|
||||
[Test] public void Params() |
||||
{ |
||||
string[] overloads = {"(params int[] a)", "(int a, params int[] b)"}; |
||||
Test("()", 0, overloads); |
||||
Test("(1)", 1, overloads); |
||||
Test("(1, 2)", 1, overloads); |
||||
} |
||||
|
||||
[Test] public void IntegerConversion() |
||||
{ |
||||
string[] overloads = {"<T>(T a)", "(int a)"}; |
||||
Test("(1)", 1, overloads); |
||||
Test("(short.MaxValue)", 0, overloads); |
||||
Test("(long.MaxValue)", 0, overloads); |
||||
} |
||||
|
||||
[Test] public void NullForReferenceTypes() |
||||
{ |
||||
string[] overloads = {"(int a)", "(string a)"}; |
||||
Test("(null)", 1, overloads); |
||||
} |
||||
|
||||
[Test] public void NullForNullableType() |
||||
{ |
||||
string[] overloads = {"(int a)", "(int? a)"}; |
||||
Test("(null)", 1, overloads); |
||||
} |
||||
|
||||
[Test] public void Generic() |
||||
{ |
||||
string program = "class T<A> {} class T<A, B> {}"; |
||||
string[] overloads = {"(T<int> a)", "(T<int, string> a)", "(T<char, string> a)"}; |
||||
Test("(new T<int>())", program, 0, overloads); |
||||
Test("(new T<int, string>())", program, 1, overloads); |
||||
Test("(new T<char, string>())", program, 2, overloads); |
||||
} |
||||
|
||||
NRefactoryResolverTests nrrt = new NRefactoryResolverTests(); |
||||
|
||||
void Test(string callExpr, int num, params string[] signatures) |
||||
{ |
||||
Test(callExpr, "", num, signatures); |
||||
} |
||||
|
||||
void Test(string callExpr, string extraCode, int num, params string[] signatures) |
||||
{ |
||||
StringBuilder b = new StringBuilder(); |
||||
int lineNumber = 0; |
||||
++lineNumber; b.AppendLine("using System;"); |
||||
++lineNumber; b.AppendLine("using System.Windows.Forms;"); |
||||
++lineNumber; b.AppendLine("class TestClass {"); |
||||
++lineNumber; b.AppendLine(" void callingMethod() {"); |
||||
++lineNumber; b.AppendLine(" "); |
||||
int callPosition = lineNumber; |
||||
++lineNumber; b.AppendLine(" }"); |
||||
int[] positions = new int[signatures.Length]; |
||||
for (int i = 0; i < signatures.Length; i++) { |
||||
b.Append(" void Method"); |
||||
b.Append(signatures[i]); |
||||
++lineNumber; b.AppendLine(" {"); |
||||
positions[i] = lineNumber; |
||||
++lineNumber; b.AppendLine(" }"); |
||||
} |
||||
b.AppendLine("}"); |
||||
b.Append(extraCode); |
||||
MemberResolveResult mrr = nrrt.Resolve<MemberResolveResult>(b.ToString(), "Method" + callExpr, callPosition); |
||||
string msg = "wrong overload: "; |
||||
for (int i = 0; i < positions.Length; i++) { |
||||
if (positions[i] == mrr.ResolvedMember.Region.BeginLine) |
||||
msg += signatures[i]; |
||||
} |
||||
Assert.AreEqual(positions[num], mrr.ResolvedMember.Region.BeginLine, msg); |
||||
} |
||||
|
||||
[Test] |
||||
public void MultipleOverloadsWithImplicitLambda() |
||||
{ |
||||
string program = @"class MainClass {
|
||||
void Main() { |
||||
M(x=>x.ToUpper()); |
||||
} |
||||
delegate R Func<T, R>(T arg); |
||||
int M(Func<int, int> f){ /* whatever ... */ } |
||||
string M(Func<string, string> f){ /* whatever ... */ } |
||||
}";
|
||||
var mrr = nrrt.Resolve<MemberResolveResult>(program, "M(x=>x.ToUpper())", 3, 3, ExpressionContext.Default); |
||||
Assert.AreEqual("System.String", mrr.ResolvedType.DotNetName); |
||||
} |
||||
|
||||
[Test] |
||||
public void MultipleOverloadsWithImplicitLambda2() |
||||
{ |
||||
string program = @"class MainClass {
|
||||
void Main() { |
||||
M(x=>x.Length); |
||||
} |
||||
delegate R Func<T, R>(T arg); |
||||
int M(Func<int, int> f){ /* whatever ... */ } |
||||
string M(Func<string, int> f){ /* whatever ... */ } |
||||
}";
|
||||
var mrr = nrrt.Resolve<MemberResolveResult>(program, "M(x=>x.Length)", 3, 3, ExpressionContext.Default); |
||||
Assert.AreEqual("System.String", mrr.ResolvedType.DotNetName); |
||||
} |
||||
|
||||
[Test] |
||||
public void MultipleOverloadsWithImplicitLambda3() |
||||
{ |
||||
string program = @"class MainClass {
|
||||
void Main() { |
||||
M(x=>x+x); |
||||
} |
||||
delegate R Func<T, R>(T arg); |
||||
string M(Func<string, int> f){ /* whatever ... */ } |
||||
int M(Func<int, int> f){ /* whatever ... */ } |
||||
}";
|
||||
var mrr = nrrt.Resolve<MemberResolveResult>(program, "M(x=>x+x)", 3, 3, ExpressionContext.Default); |
||||
Assert.AreEqual("System.Int32", mrr.ResolvedType.DotNetName); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Text;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// [TestFixture]
|
||||
// public class OverloadFinding
|
||||
// {
|
||||
// [Test] public void Simple()
|
||||
// {
|
||||
// Test("(\"Hallo\")", 0, "(string a)", "(int b)");
|
||||
// Test("(2)", 1, "(string a)", "(int b)");
|
||||
// }
|
||||
//
|
||||
// [Test] public void WinForms()
|
||||
// {
|
||||
// string[] overloads = {"(object a)", "(TextBoxBase a)", "(Control a)", "(RichTextBox a)"};
|
||||
// Test("(new RichTextBox())", 3, overloads);
|
||||
// Test("(new Control())", 2, overloads);
|
||||
// Test("(new TextBox())", 1, overloads);
|
||||
// Test("(new Button())", 2, overloads);
|
||||
// Test("(3)", 0, overloads);
|
||||
// }
|
||||
//
|
||||
// [Test] public void Params()
|
||||
// {
|
||||
// string[] overloads = {"(params int[] a)", "(int a, params int[] b)"};
|
||||
// Test("()", 0, overloads);
|
||||
// Test("(1)", 1, overloads);
|
||||
// Test("(1, 2)", 1, overloads);
|
||||
// }
|
||||
//
|
||||
// [Test] public void IntegerConversion()
|
||||
// {
|
||||
// string[] overloads = {"<T>(T a)", "(int a)"};
|
||||
// Test("(1)", 1, overloads);
|
||||
// Test("(short.MaxValue)", 0, overloads);
|
||||
// Test("(long.MaxValue)", 0, overloads);
|
||||
// }
|
||||
//
|
||||
// [Test] public void NullForReferenceTypes()
|
||||
// {
|
||||
// string[] overloads = {"(int a)", "(string a)"};
|
||||
// Test("(null)", 1, overloads);
|
||||
// }
|
||||
//
|
||||
// [Test] public void NullForNullableType()
|
||||
// {
|
||||
// string[] overloads = {"(int a)", "(int? a)"};
|
||||
// Test("(null)", 1, overloads);
|
||||
// }
|
||||
//
|
||||
// [Test] public void Generic()
|
||||
// {
|
||||
// string program = "class T<A> {} class T<A, B> {}";
|
||||
// string[] overloads = {"(T<int> a)", "(T<int, string> a)", "(T<char, string> a)"};
|
||||
// Test("(new T<int>())", program, 0, overloads);
|
||||
// Test("(new T<int, string>())", program, 1, overloads);
|
||||
// Test("(new T<char, string>())", program, 2, overloads);
|
||||
// }
|
||||
//
|
||||
// NRefactoryResolverTests nrrt = new NRefactoryResolverTests();
|
||||
//
|
||||
// void Test(string callExpr, int num, params string[] signatures)
|
||||
// {
|
||||
// Test(callExpr, "", num, signatures);
|
||||
// }
|
||||
//
|
||||
// void Test(string callExpr, string extraCode, int num, params string[] signatures)
|
||||
// {
|
||||
// StringBuilder b = new StringBuilder();
|
||||
// int lineNumber = 0;
|
||||
// ++lineNumber; b.AppendLine("using System;");
|
||||
// ++lineNumber; b.AppendLine("using System.Windows.Forms;");
|
||||
// ++lineNumber; b.AppendLine("class TestClass {");
|
||||
// ++lineNumber; b.AppendLine(" void callingMethod() {");
|
||||
// ++lineNumber; b.AppendLine(" ");
|
||||
// int callPosition = lineNumber;
|
||||
// ++lineNumber; b.AppendLine(" }");
|
||||
// int[] positions = new int[signatures.Length];
|
||||
// for (int i = 0; i < signatures.Length; i++) {
|
||||
// b.Append(" void Method");
|
||||
// b.Append(signatures[i]);
|
||||
// ++lineNumber; b.AppendLine(" {");
|
||||
// positions[i] = lineNumber;
|
||||
// ++lineNumber; b.AppendLine(" }");
|
||||
// }
|
||||
// b.AppendLine("}");
|
||||
// b.Append(extraCode);
|
||||
// MemberResolveResult mrr = nrrt.Resolve<MemberResolveResult>(b.ToString(), "Method" + callExpr, callPosition);
|
||||
// string msg = "wrong overload: ";
|
||||
// for (int i = 0; i < positions.Length; i++) {
|
||||
// if (positions[i] == mrr.ResolvedMember.Region.BeginLine)
|
||||
// msg += signatures[i];
|
||||
// }
|
||||
// Assert.AreEqual(positions[num], mrr.ResolvedMember.Region.BeginLine, msg);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void MultipleOverloadsWithImplicitLambda()
|
||||
// {
|
||||
// string program = @"class MainClass {
|
||||
// void Main() {
|
||||
// M(x=>x.ToUpper());
|
||||
// }
|
||||
// delegate R Func<T, R>(T arg);
|
||||
// int M(Func<int, int> f){ /* whatever ... */ }
|
||||
// string M(Func<string, string> f){ /* whatever ... */ }
|
||||
//}";
|
||||
// var mrr = nrrt.Resolve<MemberResolveResult>(program, "M(x=>x.ToUpper())", 3, 3, ExpressionContext.Default);
|
||||
// Assert.AreEqual("System.String", mrr.ResolvedType.DotNetName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void MultipleOverloadsWithImplicitLambda2()
|
||||
// {
|
||||
// string program = @"class MainClass {
|
||||
// void Main() {
|
||||
// M(x=>x.Length);
|
||||
// }
|
||||
// delegate R Func<T, R>(T arg);
|
||||
// int M(Func<int, int> f){ /* whatever ... */ }
|
||||
// string M(Func<string, int> f){ /* whatever ... */ }
|
||||
//}";
|
||||
// var mrr = nrrt.Resolve<MemberResolveResult>(program, "M(x=>x.Length)", 3, 3, ExpressionContext.Default);
|
||||
// Assert.AreEqual("System.String", mrr.ResolvedType.DotNetName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void MultipleOverloadsWithImplicitLambda3()
|
||||
// {
|
||||
// string program = @"class MainClass {
|
||||
// void Main() {
|
||||
// M(x=>x+x);
|
||||
// }
|
||||
// delegate R Func<T, R>(T arg);
|
||||
// string M(Func<string, int> f){ /* whatever ... */ }
|
||||
// int M(Func<int, int> f){ /* whatever ... */ }
|
||||
//}";
|
||||
// var mrr = nrrt.Resolve<MemberResolveResult>(program, "M(x=>x+x)", 3, 3, ExpressionContext.Default);
|
||||
// Assert.AreEqual("System.Int32", mrr.ResolvedType.DotNetName);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,136 +1,137 @@
@@ -1,136 +1,137 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Tests.Utils; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
/// <summary>
|
||||
/// Tests the OverrideCompletionDataProvider GetOverridableMethods.
|
||||
/// This method should be added to the IClass interface.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class OverridableMethodsTestFixture |
||||
{ |
||||
MockClass c; |
||||
MockDefaultReturnType returnType; |
||||
List<IMethod> expectedMethods; |
||||
MockClass declaringType; |
||||
|
||||
[SetUp] |
||||
public void SetUp() |
||||
{ |
||||
expectedMethods = new List<IMethod>(); |
||||
c = new MockClass("MyClass"); |
||||
declaringType = new MockClass("MyDeclaringType"); |
||||
returnType = new MockDefaultReturnType(); |
||||
c.DefaultReturnType = returnType; |
||||
} |
||||
|
||||
IMethod[] GetOverridableMethods(IClass baseClass) |
||||
{ |
||||
return OverrideCompletionItemProvider.GetOverridableMethods(new MockClass("DerivedClass") { BaseType = baseClass.DefaultReturnType }); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Add one overridable method to the return type and this
|
||||
/// should be returned in the list of overridable methods.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void OneOverridableMethodReturned() |
||||
{ |
||||
MockMethod method = new MockMethod("Run"); |
||||
method.DeclaringType = declaringType; |
||||
method.IsOverridable = true; |
||||
returnType.Methods.Add(method); |
||||
|
||||
expectedMethods.Add(method); |
||||
|
||||
IMethod[] methods = GetOverridableMethods(c); |
||||
|
||||
AssertAreMethodsEqual(expectedMethods, methods); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Make sure that an overridable method is not returned when
|
||||
/// it is part of the class being considered.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void OverridableMethodPartOfClass() |
||||
{ |
||||
MockMethod method = new MockMethod("Run"); |
||||
method.DeclaringType = c; |
||||
method.IsOverridable = true; |
||||
returnType.Methods.Add(method); |
||||
|
||||
IMethod[] methods = OverrideCompletionItemProvider.GetOverridableMethods(c); |
||||
|
||||
AssertAreMethodsEqual(expectedMethods, methods); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// An overridable but const method should not be returned.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void OverridableConstMethodNotReturned() |
||||
{ |
||||
MockMethod method = new MockMethod("Run"); |
||||
method.DeclaringType = declaringType; |
||||
method.IsOverridable = true; |
||||
method.IsConst = true; |
||||
returnType.Methods.Add(method); |
||||
|
||||
IMethod[] methods = GetOverridableMethods(c); |
||||
|
||||
AssertAreMethodsEqual(expectedMethods, methods); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// An overridable but private method should not be returned.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void OverridablePrivateMethodNotReturned() |
||||
{ |
||||
MockMethod method = new MockMethod("Run"); |
||||
method.DeclaringType = declaringType; |
||||
method.IsOverridable = true; |
||||
method.IsPrivate = true; |
||||
returnType.Methods.Add(method); |
||||
|
||||
IMethod[] methods = GetOverridableMethods(c); |
||||
|
||||
AssertAreMethodsEqual(expectedMethods, methods); |
||||
} |
||||
|
||||
[Test] |
||||
[ExpectedException(typeof(ArgumentException))] |
||||
public void NullArgument() |
||||
{ |
||||
OverrideCompletionItemProvider.GetOverridableMethods(null); |
||||
} |
||||
|
||||
void AssertAreMethodsEqual(List<IMethod> expectedMethods, IMethod[] methods) |
||||
{ |
||||
// Get a list of expected method names.
|
||||
List<string> expectedMethodNames = new List<string>(); |
||||
foreach (IMethod expectedMethod in expectedMethods) { |
||||
expectedMethodNames.Add(expectedMethod.Name); |
||||
} |
||||
|
||||
// Get a list of actual method names.
|
||||
List<string> methodNames = new List<string>(); |
||||
foreach (IMethod m in methods) { |
||||
methodNames.Add(m.Name); |
||||
} |
||||
|
||||
// Compare the two arrays.
|
||||
Assert.AreEqual(expectedMethodNames.ToArray(), methodNames.ToArray()); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Editor;
|
||||
//using ICSharpCode.SharpDevelop.Tests.Utils;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests the OverrideCompletionDataProvider GetOverridableMethods.
|
||||
// /// This method should be added to the IClass interface.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class OverridableMethodsTestFixture
|
||||
// {
|
||||
// MockClass c;
|
||||
// MockDefaultReturnType returnType;
|
||||
// List<IMethod> expectedMethods;
|
||||
// MockClass declaringType;
|
||||
//
|
||||
// [SetUp]
|
||||
// public void SetUp()
|
||||
// {
|
||||
// expectedMethods = new List<IMethod>();
|
||||
// c = new MockClass("MyClass");
|
||||
// declaringType = new MockClass("MyDeclaringType");
|
||||
// returnType = new MockDefaultReturnType();
|
||||
// c.DefaultReturnType = returnType;
|
||||
// }
|
||||
//
|
||||
// IMethod[] GetOverridableMethods(IClass baseClass)
|
||||
// {
|
||||
// return OverrideCompletionItemProvider.GetOverridableMethods(new MockClass("DerivedClass") { BaseType = baseClass.DefaultReturnType });
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Add one overridable method to the return type and this
|
||||
// /// should be returned in the list of overridable methods.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void OneOverridableMethodReturned()
|
||||
// {
|
||||
// MockMethod method = new MockMethod("Run");
|
||||
// method.DeclaringType = declaringType;
|
||||
// method.IsOverridable = true;
|
||||
// returnType.Methods.Add(method);
|
||||
//
|
||||
// expectedMethods.Add(method);
|
||||
//
|
||||
// IMethod[] methods = GetOverridableMethods(c);
|
||||
//
|
||||
// AssertAreMethodsEqual(expectedMethods, methods);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Make sure that an overridable method is not returned when
|
||||
// /// it is part of the class being considered.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void OverridableMethodPartOfClass()
|
||||
// {
|
||||
// MockMethod method = new MockMethod("Run");
|
||||
// method.DeclaringType = c;
|
||||
// method.IsOverridable = true;
|
||||
// returnType.Methods.Add(method);
|
||||
//
|
||||
// IMethod[] methods = OverrideCompletionItemProvider.GetOverridableMethods(c);
|
||||
//
|
||||
// AssertAreMethodsEqual(expectedMethods, methods);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// An overridable but const method should not be returned.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void OverridableConstMethodNotReturned()
|
||||
// {
|
||||
// MockMethod method = new MockMethod("Run");
|
||||
// method.DeclaringType = declaringType;
|
||||
// method.IsOverridable = true;
|
||||
// method.IsConst = true;
|
||||
// returnType.Methods.Add(method);
|
||||
//
|
||||
// IMethod[] methods = GetOverridableMethods(c);
|
||||
//
|
||||
// AssertAreMethodsEqual(expectedMethods, methods);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// An overridable but private method should not be returned.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void OverridablePrivateMethodNotReturned()
|
||||
// {
|
||||
// MockMethod method = new MockMethod("Run");
|
||||
// method.DeclaringType = declaringType;
|
||||
// method.IsOverridable = true;
|
||||
// method.IsPrivate = true;
|
||||
// returnType.Methods.Add(method);
|
||||
//
|
||||
// IMethod[] methods = GetOverridableMethods(c);
|
||||
//
|
||||
// AssertAreMethodsEqual(expectedMethods, methods);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// [ExpectedException(typeof(ArgumentException))]
|
||||
// public void NullArgument()
|
||||
// {
|
||||
// OverrideCompletionItemProvider.GetOverridableMethods(null);
|
||||
// }
|
||||
//
|
||||
// void AssertAreMethodsEqual(List<IMethod> expectedMethods, IMethod[] methods)
|
||||
// {
|
||||
// // Get a list of expected method names.
|
||||
// List<string> expectedMethodNames = new List<string>();
|
||||
// foreach (IMethod expectedMethod in expectedMethods) {
|
||||
// expectedMethodNames.Add(expectedMethod.Name);
|
||||
// }
|
||||
//
|
||||
// // Get a list of actual method names.
|
||||
// List<string> methodNames = new List<string>();
|
||||
// foreach (IMethod m in methods) {
|
||||
// methodNames.Add(m.Name);
|
||||
// }
|
||||
//
|
||||
// // Compare the two arrays.
|
||||
// Assert.AreEqual(expectedMethodNames.ToArray(), methodNames.ToArray());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,136 +1,137 @@
@@ -1,136 +1,137 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop.Editor.CodeCompletion; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Tests.Utils; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
/// <summary>
|
||||
/// Tests the OverrideCompletionDataProvider GetOverridableProperties.
|
||||
/// This property should be added to the IClass interface.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class OverridablePropertiesTestFixture |
||||
{ |
||||
MockClass c; |
||||
MockDefaultReturnType returnType; |
||||
List<IProperty> expectedProperties; |
||||
MockClass declaringType; |
||||
|
||||
[SetUp] |
||||
public void SetUp() |
||||
{ |
||||
expectedProperties = new List<IProperty>(); |
||||
c = new MockClass("MyClass"); |
||||
declaringType = new MockClass("MyDeclaringType"); |
||||
returnType = new MockDefaultReturnType(); |
||||
c.DefaultReturnType = returnType; |
||||
} |
||||
|
||||
IProperty[] GetOverridableProperties(IClass baseClass) |
||||
{ |
||||
return OverrideCompletionItemProvider.GetOverridableProperties(new MockClass("DerivedClass") { BaseType = baseClass.DefaultReturnType }); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Add one overridable property to the return type and this
|
||||
/// should be returned in the list of overridable properties.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void OneOverridablePropertyReturned() |
||||
{ |
||||
MockProperty property = new MockProperty("IsRunning"); |
||||
property.DeclaringType = declaringType; |
||||
property.IsOverridable = true; |
||||
returnType.Properties.Add(property); |
||||
|
||||
expectedProperties.Add(property); |
||||
|
||||
IProperty[] properties = GetOverridableProperties(c); |
||||
|
||||
AssertArePropertiesEqual(expectedProperties, properties); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Make sure that an overridable property is not returned when
|
||||
/// it is part of the class being considered.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void OverridablePropertyPartOfClass() |
||||
{ |
||||
MockProperty property = new MockProperty("IsRunning"); |
||||
property.DeclaringType = c; |
||||
property.IsOverridable = true; |
||||
returnType.Properties.Add(property); |
||||
|
||||
IProperty[] properties = OverrideCompletionItemProvider.GetOverridableProperties(c); |
||||
|
||||
AssertArePropertiesEqual(expectedProperties, properties); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// An overridable but const property should not be returned.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void OverridableConstPropertyNotReturned() |
||||
{ |
||||
MockProperty property = new MockProperty("IsRunning"); |
||||
property.DeclaringType = declaringType; |
||||
property.IsOverridable = true; |
||||
property.IsConst = true; |
||||
returnType.Properties.Add(property); |
||||
|
||||
IProperty[] properties = GetOverridableProperties(c); |
||||
|
||||
AssertArePropertiesEqual(expectedProperties, properties); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// An overridable but private property should not be returned.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void OverridablePrivatePropertyNotReturned() |
||||
{ |
||||
MockProperty property = new MockProperty("Run"); |
||||
property.DeclaringType = declaringType; |
||||
property.IsOverridable = true; |
||||
property.IsPrivate = true; |
||||
returnType.Properties.Add(property); |
||||
|
||||
IProperty[] properties = GetOverridableProperties(c); |
||||
|
||||
AssertArePropertiesEqual(expectedProperties, properties); |
||||
} |
||||
|
||||
[Test] |
||||
[ExpectedException(typeof(ArgumentException))] |
||||
public void NullArgument() |
||||
{ |
||||
OverrideCompletionItemProvider.GetOverridableProperties(null); |
||||
} |
||||
|
||||
void AssertArePropertiesEqual(List<IProperty> expectedProperties, IProperty[] properties) |
||||
{ |
||||
// Get a list of expected property names.
|
||||
List<string> expectedPropertyNames = new List<string>(); |
||||
foreach (IProperty expectedProperty in expectedProperties) { |
||||
expectedPropertyNames.Add(expectedProperty.Name); |
||||
} |
||||
|
||||
// Get a list of actual property names.
|
||||
List<string> propertyNames = new List<string>(); |
||||
foreach (IProperty p in properties) { |
||||
propertyNames.Add(p.Name); |
||||
} |
||||
|
||||
// Compare the two arrays.
|
||||
Assert.AreEqual(expectedPropertyNames.ToArray(), propertyNames.ToArray()); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Editor;
|
||||
//using ICSharpCode.SharpDevelop.Tests.Utils;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests the OverrideCompletionDataProvider GetOverridableProperties.
|
||||
// /// This property should be added to the IClass interface.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class OverridablePropertiesTestFixture
|
||||
// {
|
||||
// MockClass c;
|
||||
// MockDefaultReturnType returnType;
|
||||
// List<IProperty> expectedProperties;
|
||||
// MockClass declaringType;
|
||||
//
|
||||
// [SetUp]
|
||||
// public void SetUp()
|
||||
// {
|
||||
// expectedProperties = new List<IProperty>();
|
||||
// c = new MockClass("MyClass");
|
||||
// declaringType = new MockClass("MyDeclaringType");
|
||||
// returnType = new MockDefaultReturnType();
|
||||
// c.DefaultReturnType = returnType;
|
||||
// }
|
||||
//
|
||||
// IProperty[] GetOverridableProperties(IClass baseClass)
|
||||
// {
|
||||
// return OverrideCompletionItemProvider.GetOverridableProperties(new MockClass("DerivedClass") { BaseType = baseClass.DefaultReturnType });
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Add one overridable property to the return type and this
|
||||
// /// should be returned in the list of overridable properties.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void OneOverridablePropertyReturned()
|
||||
// {
|
||||
// MockProperty property = new MockProperty("IsRunning");
|
||||
// property.DeclaringType = declaringType;
|
||||
// property.IsOverridable = true;
|
||||
// returnType.Properties.Add(property);
|
||||
//
|
||||
// expectedProperties.Add(property);
|
||||
//
|
||||
// IProperty[] properties = GetOverridableProperties(c);
|
||||
//
|
||||
// AssertArePropertiesEqual(expectedProperties, properties);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Make sure that an overridable property is not returned when
|
||||
// /// it is part of the class being considered.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void OverridablePropertyPartOfClass()
|
||||
// {
|
||||
// MockProperty property = new MockProperty("IsRunning");
|
||||
// property.DeclaringType = c;
|
||||
// property.IsOverridable = true;
|
||||
// returnType.Properties.Add(property);
|
||||
//
|
||||
// IProperty[] properties = OverrideCompletionItemProvider.GetOverridableProperties(c);
|
||||
//
|
||||
// AssertArePropertiesEqual(expectedProperties, properties);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// An overridable but const property should not be returned.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void OverridableConstPropertyNotReturned()
|
||||
// {
|
||||
// MockProperty property = new MockProperty("IsRunning");
|
||||
// property.DeclaringType = declaringType;
|
||||
// property.IsOverridable = true;
|
||||
// property.IsConst = true;
|
||||
// returnType.Properties.Add(property);
|
||||
//
|
||||
// IProperty[] properties = GetOverridableProperties(c);
|
||||
//
|
||||
// AssertArePropertiesEqual(expectedProperties, properties);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// An overridable but private property should not be returned.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void OverridablePrivatePropertyNotReturned()
|
||||
// {
|
||||
// MockProperty property = new MockProperty("Run");
|
||||
// property.DeclaringType = declaringType;
|
||||
// property.IsOverridable = true;
|
||||
// property.IsPrivate = true;
|
||||
// returnType.Properties.Add(property);
|
||||
//
|
||||
// IProperty[] properties = GetOverridableProperties(c);
|
||||
//
|
||||
// AssertArePropertiesEqual(expectedProperties, properties);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// [ExpectedException(typeof(ArgumentException))]
|
||||
// public void NullArgument()
|
||||
// {
|
||||
// OverrideCompletionItemProvider.GetOverridableProperties(null);
|
||||
// }
|
||||
//
|
||||
// void AssertArePropertiesEqual(List<IProperty> expectedProperties, IProperty[] properties)
|
||||
// {
|
||||
// // Get a list of expected property names.
|
||||
// List<string> expectedPropertyNames = new List<string>();
|
||||
// foreach (IProperty expectedProperty in expectedProperties) {
|
||||
// expectedPropertyNames.Add(expectedProperty.Name);
|
||||
// }
|
||||
//
|
||||
// // Get a list of actual property names.
|
||||
// List<string> propertyNames = new List<string>();
|
||||
// foreach (IProperty p in properties) {
|
||||
// propertyNames.Add(p.Name);
|
||||
// }
|
||||
//
|
||||
// // Compare the two arrays.
|
||||
// Assert.AreEqual(expectedPropertyNames.ToArray(), propertyNames.ToArray());
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,62 +1,63 @@
@@ -1,62 +1,63 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.NRefactory; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class ReadOnlyDocumentTests |
||||
{ |
||||
[Test] |
||||
public void EmptyReadOnlyDocument() |
||||
{ |
||||
IDocument document = DocumentUtilitites.LoadReadOnlyDocumentFromBuffer(new StringTextBuffer(string.Empty)); |
||||
Assert.AreEqual(string.Empty, document.Text); |
||||
Assert.AreEqual(0, document.TextLength); |
||||
Assert.AreEqual(1, document.TotalNumberOfLines); |
||||
Assert.AreEqual(0, document.PositionToOffset(1, 1)); |
||||
Assert.AreEqual(new Location(1, 1), document.OffsetToPosition(0)); |
||||
|
||||
Assert.AreEqual(0, document.GetLine(1).Offset); |
||||
Assert.AreEqual(0, document.GetLine(1).EndOffset); |
||||
Assert.AreEqual(0, document.GetLine(1).Length); |
||||
Assert.AreEqual(0, document.GetLine(1).TotalLength); |
||||
Assert.AreEqual(0, document.GetLine(1).DelimiterLength); |
||||
Assert.AreEqual(1, document.GetLine(1).LineNumber); |
||||
} |
||||
|
||||
[Test] |
||||
public void SimpleDocument() |
||||
{ |
||||
string text = "Hello\nWorld!\r\n"; |
||||
IDocument document = DocumentUtilitites.LoadReadOnlyDocumentFromBuffer(new StringTextBuffer(text)); |
||||
Assert.AreEqual(text, document.Text); |
||||
Assert.AreEqual(3, document.TotalNumberOfLines); |
||||
|
||||
Assert.AreEqual(0, document.GetLine(1).Offset); |
||||
Assert.AreEqual(5, document.GetLine(1).EndOffset); |
||||
Assert.AreEqual(5, document.GetLine(1).Length); |
||||
Assert.AreEqual(6, document.GetLine(1).TotalLength); |
||||
Assert.AreEqual(1, document.GetLine(1).DelimiterLength); |
||||
Assert.AreEqual(1, document.GetLine(1).LineNumber); |
||||
|
||||
Assert.AreEqual(6, document.GetLine(2).Offset); |
||||
Assert.AreEqual(12, document.GetLine(2).EndOffset); |
||||
Assert.AreEqual(6, document.GetLine(2).Length); |
||||
Assert.AreEqual(8, document.GetLine(2).TotalLength); |
||||
Assert.AreEqual(2, document.GetLine(2).DelimiterLength); |
||||
Assert.AreEqual(2, document.GetLine(2).LineNumber); |
||||
|
||||
Assert.AreEqual(14, document.GetLine(3).Offset); |
||||
Assert.AreEqual(14, document.GetLine(3).EndOffset); |
||||
Assert.AreEqual(0, document.GetLine(3).Length); |
||||
Assert.AreEqual(0, document.GetLine(3).TotalLength); |
||||
Assert.AreEqual(0, document.GetLine(3).DelimiterLength); |
||||
Assert.AreEqual(3, document.GetLine(3).LineNumber); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.NRefactory;
|
||||
//using ICSharpCode.SharpDevelop.Editor;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// [TestFixture]
|
||||
// public class ReadOnlyDocumentTests
|
||||
// {
|
||||
// [Test]
|
||||
// public void EmptyReadOnlyDocument()
|
||||
// {
|
||||
// IDocument document = DocumentUtilitites.LoadReadOnlyDocumentFromBuffer(new StringTextBuffer(string.Empty));
|
||||
// Assert.AreEqual(string.Empty, document.Text);
|
||||
// Assert.AreEqual(0, document.TextLength);
|
||||
// Assert.AreEqual(1, document.TotalNumberOfLines);
|
||||
// Assert.AreEqual(0, document.PositionToOffset(1, 1));
|
||||
// Assert.AreEqual(new Location(1, 1), document.OffsetToPosition(0));
|
||||
//
|
||||
// Assert.AreEqual(0, document.GetLine(1).Offset);
|
||||
// Assert.AreEqual(0, document.GetLine(1).EndOffset);
|
||||
// Assert.AreEqual(0, document.GetLine(1).Length);
|
||||
// Assert.AreEqual(0, document.GetLine(1).TotalLength);
|
||||
// Assert.AreEqual(0, document.GetLine(1).DelimiterLength);
|
||||
// Assert.AreEqual(1, document.GetLine(1).LineNumber);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SimpleDocument()
|
||||
// {
|
||||
// string text = "Hello\nWorld!\r\n";
|
||||
// IDocument document = DocumentUtilitites.LoadReadOnlyDocumentFromBuffer(new StringTextBuffer(text));
|
||||
// Assert.AreEqual(text, document.Text);
|
||||
// Assert.AreEqual(3, document.TotalNumberOfLines);
|
||||
//
|
||||
// Assert.AreEqual(0, document.GetLine(1).Offset);
|
||||
// Assert.AreEqual(5, document.GetLine(1).EndOffset);
|
||||
// Assert.AreEqual(5, document.GetLine(1).Length);
|
||||
// Assert.AreEqual(6, document.GetLine(1).TotalLength);
|
||||
// Assert.AreEqual(1, document.GetLine(1).DelimiterLength);
|
||||
// Assert.AreEqual(1, document.GetLine(1).LineNumber);
|
||||
//
|
||||
// Assert.AreEqual(6, document.GetLine(2).Offset);
|
||||
// Assert.AreEqual(12, document.GetLine(2).EndOffset);
|
||||
// Assert.AreEqual(6, document.GetLine(2).Length);
|
||||
// Assert.AreEqual(8, document.GetLine(2).TotalLength);
|
||||
// Assert.AreEqual(2, document.GetLine(2).DelimiterLength);
|
||||
// Assert.AreEqual(2, document.GetLine(2).LineNumber);
|
||||
//
|
||||
// Assert.AreEqual(14, document.GetLine(3).Offset);
|
||||
// Assert.AreEqual(14, document.GetLine(3).EndOffset);
|
||||
// Assert.AreEqual(0, document.GetLine(3).Length);
|
||||
// Assert.AreEqual(0, document.GetLine(3).TotalLength);
|
||||
// Assert.AreEqual(0, document.GetLine(3).DelimiterLength);
|
||||
// Assert.AreEqual(3, document.GetLine(3).LineNumber);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,47 +1,48 @@
@@ -1,47 +1,48 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections; |
||||
using System.IO; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Dom.NRefactoryResolver; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
//[TestFixture]
|
||||
public class RefactoringTests |
||||
{ |
||||
const string code = @"using System;
|
||||
abstract class BaseClass { |
||||
protected abstract void FirstMethod(); |
||||
|
||||
protected virtual void SecondMethod() |
||||
{ |
||||
} |
||||
} |
||||
class DerivedClass : BaseClass |
||||
{ |
||||
protected override void FirstMethod() |
||||
{ |
||||
SecondMethod(); |
||||
} |
||||
} |
||||
class SecondDerivedClass : DerivedClass |
||||
{ |
||||
protected override void FirstMethod() |
||||
{ |
||||
Console.Beep(); |
||||
} |
||||
protected override void SecondMethod() |
||||
{ |
||||
FirstMethod(); |
||||
} |
||||
} |
||||
";
|
||||
|
||||
// TODO: Write unit tests for find references / find overrides / go to base class.
|
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections;
|
||||
//using System.IO;
|
||||
//using NUnit.Framework;
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Dom.NRefactoryResolver;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// //[TestFixture]
|
||||
// public class RefactoringTests
|
||||
// {
|
||||
// const string code = @"using System;
|
||||
//abstract class BaseClass {
|
||||
// protected abstract void FirstMethod();
|
||||
//
|
||||
// protected virtual void SecondMethod()
|
||||
// {
|
||||
// }
|
||||
//}
|
||||
//class DerivedClass : BaseClass
|
||||
//{
|
||||
// protected override void FirstMethod()
|
||||
// {
|
||||
// SecondMethod();
|
||||
// }
|
||||
//}
|
||||
//class SecondDerivedClass : DerivedClass
|
||||
//{
|
||||
// protected override void FirstMethod()
|
||||
// {
|
||||
// Console.Beep();
|
||||
// }
|
||||
// protected override void SecondMethod()
|
||||
// {
|
||||
// FirstMethod();
|
||||
// }
|
||||
//}
|
||||
//";
|
||||
//
|
||||
// // TODO: Write unit tests for find references / find overrides / go to base class.
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,443 +1,444 @@
@@ -1,443 +1,444 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.IO; |
||||
using System.Linq; |
||||
using System.Reflection; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Dom.CSharp; |
||||
using ICSharpCode.SharpDevelop.Dom.ReflectionLayer; |
||||
using NUnit.Framework; |
||||
|
||||
[assembly: ICSharpCode.SharpDevelop.Tests.TypeTestAttribute( |
||||
42, typeof(System.Action<>), typeof(IDictionary<string, IList<TestAttribute>>))] |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
public class TypeTestAttribute : Attribute |
||||
{ |
||||
public TypeTestAttribute(int a1, Type a2, Type a3) {} |
||||
} |
||||
|
||||
[TestFixture] |
||||
public class ReflectionLayerTests : ReflectionOrCecilLayerTests |
||||
{ |
||||
public ReflectionLayerTests() |
||||
{ |
||||
mscorlib = AssemblyParserService.DefaultProjectContentRegistry.Mscorlib; |
||||
} |
||||
|
||||
protected override IClass GetClass(Type type) |
||||
{ |
||||
ICompilationUnit cu = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], AssemblyParserService.DefaultProjectContentRegistry).AssemblyCompilationUnit; |
||||
((ReflectionProjectContent)cu.ProjectContent).AddReferencedContent(mscorlib); |
||||
IClass c = new ReflectionClass(cu, type, type.FullName, null); |
||||
cu.ProjectContent.AddClassToNamespaceList(c); |
||||
return c; |
||||
} |
||||
|
||||
protected override IEnumerable<IAttribute> GetAssemblyAttributes(Assembly assembly) |
||||
{ |
||||
var pc = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], AssemblyParserService.DefaultProjectContentRegistry); |
||||
pc.AddAssemblyAttributes(assembly); |
||||
return pc.GetAssemblyAttributes(); |
||||
} |
||||
} |
||||
|
||||
[TestFixture] |
||||
public class ReflectionWithRoundTripLayerTests : ReflectionOrCecilLayerTests |
||||
{ |
||||
public ReflectionWithRoundTripLayerTests() |
||||
{ |
||||
mscorlib = AssemblyParserService.DefaultProjectContentRegistry.Mscorlib; |
||||
|
||||
MemoryStream memory = new MemoryStream(); |
||||
DomPersistence.WriteProjectContent((ReflectionProjectContent)mscorlib, memory); |
||||
memory.Position = 0; |
||||
mscorlib = DomPersistence.LoadProjectContent(memory, AssemblyParserService.DefaultProjectContentRegistry); |
||||
} |
||||
|
||||
protected override IClass GetClass(Type type) |
||||
{ |
||||
ICompilationUnit cu = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], AssemblyParserService.DefaultProjectContentRegistry).AssemblyCompilationUnit; |
||||
IClass c = new ReflectionClass(cu, type, type.FullName, null); |
||||
cu.ProjectContent.AddClassToNamespaceList(c); |
||||
|
||||
MemoryStream memory = new MemoryStream(); |
||||
DomPersistence.WriteProjectContent((ReflectionProjectContent)c.ProjectContent, memory); |
||||
|
||||
memory.Position = 0; |
||||
ReflectionProjectContent loadedPC = DomPersistence.LoadProjectContent(memory, AssemblyParserService.DefaultProjectContentRegistry); |
||||
loadedPC.AddReferencedContent(mscorlib); |
||||
return loadedPC.Classes.Single(); |
||||
} |
||||
|
||||
protected override IEnumerable<IAttribute> GetAssemblyAttributes(Assembly assembly) |
||||
{ |
||||
var pc = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], AssemblyParserService.DefaultProjectContentRegistry); |
||||
pc.AddAssemblyAttributes(assembly); |
||||
|
||||
MemoryStream memory = new MemoryStream(); |
||||
DomPersistence.WriteProjectContent(pc, memory); |
||||
|
||||
memory.Position = 0; |
||||
return DomPersistence.LoadProjectContent(memory, AssemblyParserService.DefaultProjectContentRegistry).GetAssemblyAttributes(); |
||||
} |
||||
} |
||||
|
||||
[TestFixture] |
||||
public class CecilLayerTests : ReflectionOrCecilLayerTests |
||||
{ |
||||
public CecilLayerTests() |
||||
{ |
||||
mscorlib = CecilReader.LoadAssembly(typeof(object).Assembly.Location, AssemblyParserService.DefaultProjectContentRegistry); |
||||
} |
||||
|
||||
IProjectContent LoadAssembly(Assembly assembly) |
||||
{ |
||||
var pc = CecilReader.LoadAssembly(assembly.Location, AssemblyParserService.DefaultProjectContentRegistry); |
||||
Assert.IsNotNull(pc); |
||||
pc.AddReferencedContent(mscorlib); |
||||
return pc; |
||||
} |
||||
|
||||
protected override IClass GetClass(Type type) |
||||
{ |
||||
IClass c = LoadAssembly(type.Assembly).GetClassByReflectionName(type.FullName, false); |
||||
Assert.IsNotNull(c); |
||||
return c; |
||||
} |
||||
|
||||
protected override IEnumerable<IAttribute> GetAssemblyAttributes(Assembly assembly) |
||||
{ |
||||
return LoadAssembly(assembly).GetAssemblyAttributes(); |
||||
} |
||||
} |
||||
|
||||
public abstract class ReflectionOrCecilLayerTests |
||||
{ |
||||
protected IProjectContent mscorlib; |
||||
|
||||
[Test] |
||||
public void InheritanceTest() |
||||
{ |
||||
IClass c = mscorlib.GetClass("System.SystemException", 0); |
||||
IClass c2 = mscorlib.GetClass("System.Exception", 0); |
||||
Assert.IsNotNull(c, "c is null"); |
||||
Assert.IsNotNull(c2, "c2 is null"); |
||||
//Assert.AreEqual(3, c.BaseTypes.Count); // Inherited interfaces are not reported by Cecil
|
||||
// which matches the behaviour of our C#/VB parsers
|
||||
Assert.AreEqual("System.Exception", c.BaseTypes[0].FullyQualifiedName); |
||||
Assert.AreSame(c2, c.BaseClass); |
||||
|
||||
List<IClass> subClasses = new List<IClass>(); |
||||
foreach (IClass subClass in c.ClassInheritanceTree) { |
||||
subClasses.Add(subClass); |
||||
} |
||||
Assert.AreEqual(5, subClasses.Count, "ClassInheritanceTree length"); |
||||
Assert.AreEqual("System.SystemException", subClasses[0].FullyQualifiedName); |
||||
Assert.AreEqual("System.Exception", subClasses[1].FullyQualifiedName); |
||||
if (subClasses[2].FullyQualifiedName == "System.Object") { |
||||
Assert.AreEqual("System.Object", subClasses[2].FullyQualifiedName); |
||||
Assert.AreEqual("System.Runtime.Serialization.ISerializable", subClasses[3].FullyQualifiedName); |
||||
Assert.AreEqual("System.Runtime.InteropServices._Exception", subClasses[4].FullyQualifiedName); |
||||
} else { |
||||
Assert.AreEqual("System.Runtime.Serialization.ISerializable", subClasses[2].FullyQualifiedName); |
||||
Assert.AreEqual("System.Runtime.InteropServices._Exception", subClasses[3].FullyQualifiedName); |
||||
Assert.AreEqual("System.Object", subClasses[4].FullyQualifiedName); |
||||
} |
||||
} |
||||
|
||||
[Test] |
||||
public void GenericPropertyTest() |
||||
{ |
||||
IClass c = mscorlib.GetClass("System.Collections.Generic.Comparer", 1); |
||||
IProperty def = c.Properties.First(p => p.Name == "Default"); |
||||
ConstructedReturnType crt = def.ReturnType.CastToConstructedReturnType(); |
||||
Assert.AreEqual("System.Collections.Generic.Comparer", crt.FullyQualifiedName); |
||||
Assert.IsTrue(crt.TypeArguments[0].IsGenericReturnType); |
||||
} |
||||
|
||||
[Test] |
||||
public void PointerTypeTest() |
||||
{ |
||||
IClass c = mscorlib.GetClass("System.IntPtr", 1); |
||||
IMethod toPointer = c.Methods.First(p => p.Name == "ToPointer"); |
||||
Assert.AreEqual("System.Void*", toPointer.ReturnType.DotNetName); |
||||
PointerReturnType prt = toPointer.ReturnType.CastToDecoratingReturnType<PointerReturnType>(); |
||||
Assert.AreEqual("System.Void", prt.BaseType.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void DateTimeDefaultConstructor() |
||||
{ |
||||
IClass c = mscorlib.GetClass("System.DateTime", 0); |
||||
Assert.IsFalse(c.Methods.Any(p => p.IsConstructor && p.Parameters.Count == 0)); |
||||
Assert.IsTrue(c.AddDefaultConstructorIfRequired); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoEncodingInfoDefaultConstructor() |
||||
{ |
||||
IClass c = mscorlib.GetClass("System.Text.EncodingInfo", 0); |
||||
Assert.IsFalse(c.Methods.Any(p => p.IsConstructor)); // EncodingInfo only has an internal constructor
|
||||
Assert.IsFalse(c.AddDefaultConstructorIfRequired); |
||||
} |
||||
|
||||
[Test] |
||||
public void ParameterComparisonTest() |
||||
{ |
||||
DefaultParameter p1 = new DefaultParameter("a", mscorlib.GetClass("System.String", 0).DefaultReturnType, DomRegion.Empty); |
||||
DefaultParameter p2 = new DefaultParameter("b", new GetClassReturnType(mscorlib, "System.String", 0), DomRegion.Empty); |
||||
IList<IParameter> a1 = new List<IParameter>(); |
||||
IList<IParameter> a2 = new List<IParameter>(); |
||||
a1.Add(p1); |
||||
a2.Add(p2); |
||||
Assert.AreEqual(0, DiffUtility.Compare(a1, a2)); |
||||
} |
||||
|
||||
DefaultMethod GetMethod(IClass c, string name) |
||||
{ |
||||
IMethod result = c.Methods.FirstOrDefault(m => m.Name == name); |
||||
Assert.IsNotNull(result, "Method " + name + " not found"); |
||||
return (DefaultMethod)result; |
||||
} |
||||
|
||||
[Test] |
||||
public void GenericDocumentationTagNamesTest() |
||||
{ |
||||
DefaultClass c = (DefaultClass)mscorlib.GetClass("System.Collections.Generic.List", 1); |
||||
Assert.AreEqual("T:System.Collections.Generic.List`1", |
||||
c.DocumentationTag); |
||||
Assert.AreEqual("M:System.Collections.Generic.List`1.Add(`0)", |
||||
GetMethod(c, "Add").DocumentationTag); |
||||
Assert.AreEqual("M:System.Collections.Generic.List`1.AddRange(System.Collections.Generic.IEnumerable{`0})", |
||||
GetMethod(c, "AddRange").DocumentationTag); |
||||
Assert.AreEqual("M:System.Collections.Generic.List`1.ConvertAll``1(System.Converter{`0,``0})", |
||||
GetMethod(c, "ConvertAll").DocumentationTag); |
||||
} |
||||
|
||||
[Test] |
||||
public void StaticModifierTest() |
||||
{ |
||||
IClass c = mscorlib.GetClass("System.Environment", 0); |
||||
Assert.IsNotNull(c, "System.Environment not found"); |
||||
Assert.IsTrue(c.IsAbstract, "class should be abstract"); |
||||
Assert.IsTrue(c.IsSealed, "class should be sealed"); |
||||
Assert.IsTrue(c.IsStatic, "class should be static"); |
||||
} |
||||
|
||||
[Test] |
||||
public void InnerClassReferenceTest() |
||||
{ |
||||
IClass c = mscorlib.GetClass("System.Environment", 0); |
||||
Assert.IsNotNull(c, "System.Environment not found"); |
||||
IReturnType rt = GetMethod(c, "GetFolderPath").Parameters[0].ReturnType; |
||||
Assert.IsNotNull(rt, "ReturnType is null"); |
||||
Assert.AreEqual("System.Environment.SpecialFolder", rt.FullyQualifiedName); |
||||
IClass inner = rt.GetUnderlyingClass(); |
||||
Assert.IsNotNull(inner, "UnderlyingClass"); |
||||
Assert.AreEqual("System.Environment.SpecialFolder", inner.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void InnerClassesTest() |
||||
{ |
||||
IClass c = mscorlib.GetClass("System.Environment.SpecialFolder", 0); |
||||
Assert.IsNotNull(c, "c is null"); |
||||
Assert.AreEqual("System.Environment.SpecialFolder", c.FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void VoidTest() |
||||
{ |
||||
IClass c = mscorlib.GetClass("System.Void", 0); |
||||
Assert.IsNotNull(c, "System.Void not found"); |
||||
Assert.AreSame(c.DefaultReturnType, mscorlib.SystemTypes.Void, "pc.SystemTypes.Void is c.DefaultReturnType"); |
||||
} |
||||
|
||||
[Test] |
||||
public void NestedClassInGenericClassTest() |
||||
{ |
||||
IClass dictionary = mscorlib.GetClass("System.Collections.Generic.Dictionary", 2); |
||||
Assert.IsNotNull(dictionary); |
||||
IClass valueCollection = mscorlib.GetClass("System.Collections.Generic.Dictionary.ValueCollection", 2); |
||||
Assert.IsNotNull(valueCollection); |
||||
var dictionaryRT = new ConstructedReturnType(dictionary.DefaultReturnType, new[] { mscorlib.SystemTypes.String, mscorlib.SystemTypes.Int32 }); |
||||
IProperty valueProperty = dictionaryRT.GetProperties().Find(p => p.Name == "Values"); |
||||
Assert.AreSame(valueCollection, valueProperty.ReturnType.GetUnderlyingClass()); |
||||
} |
||||
|
||||
[Test] |
||||
public void ValueCollectionCountModifiers() |
||||
{ |
||||
IClass valueCollection = mscorlib.GetClass("System.Collections.Generic.Dictionary.ValueCollection", 2); |
||||
Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Sealed, valueCollection.Modifiers); |
||||
IProperty count = valueCollection.Properties.Single(p => p.Name == "Count"); |
||||
Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Sealed, count.Modifiers); |
||||
} |
||||
|
||||
[Test] |
||||
public void MathAcosModifiers() |
||||
{ |
||||
IClass math = mscorlib.GetClass("System.Math", 0); |
||||
Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Abstract | ModifierEnum.Sealed | ModifierEnum.Static, math.Modifiers); |
||||
IMethod acos = math.Methods.Single(p => p.Name == "Acos"); |
||||
Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Static, acos.Modifiers); |
||||
} |
||||
|
||||
[Test] |
||||
public void EncodingModifiers() |
||||
{ |
||||
IClass encoding = mscorlib.GetClass("System.Text.Encoding", 0); |
||||
Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Abstract, encoding.Modifiers); |
||||
IMethod getDecoder = encoding.Methods.Single(p => p.Name == "GetDecoder"); |
||||
Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Virtual, getDecoder.Modifiers); |
||||
IMethod getMaxByteCount = encoding.Methods.Single(p => p.Name == "GetMaxByteCount"); |
||||
Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Abstract, getMaxByteCount.Modifiers); |
||||
IProperty encoderFallback = encoding.Properties.Single(p => p.Name == "EncoderFallback"); |
||||
Assert.AreEqual(ModifierEnum.Public, encoderFallback.Modifiers); |
||||
} |
||||
|
||||
[Test] |
||||
public void UnicodeEncodingModifiers() |
||||
{ |
||||
IClass encoding = mscorlib.GetClass("System.Text.UnicodeEncoding", 0); |
||||
Assert.AreEqual(ModifierEnum.Public, encoding.Modifiers); |
||||
IMethod getDecoder = encoding.Methods.Single(p => p.Name == "GetDecoder"); |
||||
Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Override, getDecoder.Modifiers); |
||||
} |
||||
|
||||
[Test] |
||||
public void UTF32EncodingModifiers() |
||||
{ |
||||
IClass encoding = mscorlib.GetClass("System.Text.UTF32Encoding", 0); |
||||
Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Sealed, encoding.Modifiers); |
||||
IMethod getDecoder = encoding.Methods.Single(p => p.Name == "GetDecoder"); |
||||
Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Override, getDecoder.Modifiers); |
||||
} |
||||
|
||||
public class TestClass<A, B> where A : B { |
||||
public void TestMethod<K, V>(string param) where V: K where K: IComparable {} |
||||
|
||||
public void GetIndex<T>(T element) where T: IEquatable<T> {} |
||||
|
||||
public int Property { get; protected set; } |
||||
public dynamic ReadOnlyPropertyWithPrivateSetter { get; private set; } |
||||
|
||||
public List<dynamic> DynamicGenerics1(Action<object, dynamic[], object> param) { return null; } |
||||
public void DynamicGenerics2(Action<object, dynamic, object> param) { } |
||||
public void DynamicGenerics3(Action<int, dynamic, object> param) { } |
||||
public void DynamicGenerics4(Action<int[], dynamic, object> param) { } |
||||
public void DynamicGenerics5(Action<int*[], dynamic, object> param) { } |
||||
} |
||||
|
||||
protected abstract IClass GetClass(Type type); |
||||
protected abstract IEnumerable<IAttribute> GetAssemblyAttributes(Assembly assembly); |
||||
|
||||
IClass testClass; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void FixtureSetUp() |
||||
{ |
||||
testClass = GetClass(typeof(TestClass<,>)); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestClassTypeParameters() |
||||
{ |
||||
Assert.AreSame(testClass, testClass.TypeParameters[0].Class); |
||||
Assert.AreSame(testClass, testClass.TypeParameters[1].Class); |
||||
Assert.AreSame(testClass.TypeParameters[1], ((GenericReturnType)testClass.TypeParameters[0].Constraints[0]).TypeParameter); |
||||
} |
||||
|
||||
[Test] |
||||
public void TestMethod() |
||||
{ |
||||
IMethod m = testClass.Methods.Single(me => me.Name == "TestMethod"); |
||||
Assert.AreEqual("K", m.TypeParameters[0].Name); |
||||
Assert.AreEqual("V", m.TypeParameters[1].Name); |
||||
Assert.AreSame(m, m.TypeParameters[0].Method); |
||||
Assert.AreSame(m, m.TypeParameters[1].Method); |
||||
|
||||
Assert.AreEqual("IComparable", m.TypeParameters[0].Constraints[0].Name); |
||||
GenericReturnType kConst = (GenericReturnType)m.TypeParameters[1].Constraints[0]; |
||||
Assert.AreSame(m.TypeParameters[0], kConst.TypeParameter); |
||||
} |
||||
|
||||
[Test] |
||||
public void GetIndex() |
||||
{ |
||||
IMethod m = testClass.Methods.Single(me => me.Name == "GetIndex"); |
||||
Assert.AreEqual("T", m.TypeParameters[0].Name); |
||||
Assert.AreSame(m, m.TypeParameters[0].Method); |
||||
|
||||
Assert.AreEqual("IEquatable", m.TypeParameters[0].Constraints[0].Name); |
||||
Assert.AreEqual(1, m.TypeParameters[0].Constraints[0].TypeArgumentCount); |
||||
Assert.AreEqual(1, m.TypeParameters[0].Constraints[0].CastToConstructedReturnType().TypeArguments.Count); |
||||
GenericReturnType grt = (GenericReturnType)m.TypeParameters[0].Constraints[0].CastToConstructedReturnType().TypeArguments[0]; |
||||
Assert.AreSame(m.TypeParameters[0], grt.TypeParameter); |
||||
} |
||||
|
||||
[Test] |
||||
public void Property() |
||||
{ |
||||
IProperty p = testClass.Properties.Single(pr => pr.Name == "Property"); |
||||
Assert.AreEqual(ModifierEnum.Public, p.Modifiers); |
||||
Assert.AreEqual(ModifierEnum.None, p.GetterModifiers); |
||||
Assert.AreEqual(ModifierEnum.Protected, p.SetterModifiers); |
||||
} |
||||
|
||||
[Test] |
||||
public void CannotSetReadOnlyProperty() |
||||
{ |
||||
IProperty p = testClass.Properties.Single(pr => pr.Name == "ReadOnlyPropertyWithPrivateSetter"); |
||||
Assert.AreEqual(ModifierEnum.Public, p.Modifiers); |
||||
Assert.AreEqual(ModifierEnum.None, p.GetterModifiers); |
||||
Assert.IsFalse(p.CanSet); |
||||
} |
||||
|
||||
[Test] |
||||
public void DynamicType() |
||||
{ |
||||
IProperty p = testClass.Properties.Single(pr => pr.Name == "ReadOnlyPropertyWithPrivateSetter"); |
||||
Assert.IsInstanceOf(typeof(DynamicReturnType), p.ReturnType); |
||||
} |
||||
|
||||
[Test] |
||||
public void DynamicTypeInGenerics() |
||||
{ |
||||
CSharpAmbience a = new CSharpAmbience(); |
||||
a.ConversionFlags = ConversionFlags.ShowReturnType | ConversionFlags.ShowParameterList; |
||||
Assert.AreEqual("List<dynamic> DynamicGenerics1(Action<object, dynamic[], object>)", a.Convert(testClass.Methods.Single(me => me.Name == "DynamicGenerics1"))); |
||||
Assert.AreEqual("void DynamicGenerics2(Action<object, dynamic, object>)", a.Convert(testClass.Methods.Single(me => me.Name == "DynamicGenerics2"))); |
||||
Assert.AreEqual("void DynamicGenerics3(Action<int, dynamic, object>)", a.Convert(testClass.Methods.Single(me => me.Name == "DynamicGenerics3"))); |
||||
Assert.AreEqual("void DynamicGenerics4(Action<int[], dynamic, object>)", a.Convert(testClass.Methods.Single(me => me.Name == "DynamicGenerics4"))); |
||||
Assert.AreEqual("void DynamicGenerics5(Action<Int32*[], dynamic, object>)", a.Convert(testClass.Methods.Single(me => me.Name == "DynamicGenerics5"))); |
||||
} |
||||
|
||||
[Test] |
||||
public void AssemblyAttribute() |
||||
{ |
||||
var attributes = GetAssemblyAttributes(typeof(TypeTestAttribute).Assembly); |
||||
var typeTest = attributes.First(a => a.AttributeType.FullyQualifiedName == typeof(TypeTestAttribute).FullName); |
||||
Assert.AreEqual(3, typeTest.PositionalArguments.Count); |
||||
// first argument is (int)42
|
||||
Assert.AreEqual(42, (int)typeTest.PositionalArguments[0]); |
||||
// second argument is typeof(System.Action<>)
|
||||
IReturnType rt = (IReturnType)typeTest.PositionalArguments[1]; |
||||
Assert.IsNull(rt.CastToConstructedReturnType()); // rt must not be constructed - it's just an unbound type
|
||||
Assert.AreEqual("System.Action", rt.FullyQualifiedName); |
||||
Assert.AreEqual(1, rt.TypeArgumentCount); |
||||
// third argument is typeof(IDictionary<string, IList<TestAttribute>>)
|
||||
ConstructedReturnType crt = ((IReturnType)typeTest.PositionalArguments[2]).CastToConstructedReturnType(); |
||||
Assert.AreEqual("System.Collections.Generic.IDictionary", crt.FullyQualifiedName); |
||||
Assert.AreEqual("System.String", crt.TypeArguments[0].FullyQualifiedName); |
||||
Assert.AreEqual("System.Collections.Generic.IList{NUnit.Framework.TestAttribute}", crt.TypeArguments[1].DotNetName); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.IO;
|
||||
//using System.Linq;
|
||||
//using System.Reflection;
|
||||
//
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Dom.CSharp;
|
||||
//using ICSharpCode.SharpDevelop.Dom.ReflectionLayer;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//[assembly: ICSharpCode.SharpDevelop.Tests.TypeTestAttribute(
|
||||
// 42, typeof(System.Action<>), typeof(IDictionary<string, IList<TestAttribute>>))]
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// public class TypeTestAttribute : Attribute
|
||||
// {
|
||||
// public TypeTestAttribute(int a1, Type a2, Type a3) {}
|
||||
// }
|
||||
//
|
||||
// [TestFixture]
|
||||
// public class ReflectionLayerTests : ReflectionOrCecilLayerTests
|
||||
// {
|
||||
// public ReflectionLayerTests()
|
||||
// {
|
||||
// mscorlib = AssemblyParserService.DefaultProjectContentRegistry.Mscorlib;
|
||||
// }
|
||||
//
|
||||
// protected override IClass GetClass(Type type)
|
||||
// {
|
||||
// ICompilationUnit cu = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], AssemblyParserService.DefaultProjectContentRegistry).AssemblyCompilationUnit;
|
||||
// ((ReflectionProjectContent)cu.ProjectContent).AddReferencedContent(mscorlib);
|
||||
// IClass c = new ReflectionClass(cu, type, type.FullName, null);
|
||||
// cu.ProjectContent.AddClassToNamespaceList(c);
|
||||
// return c;
|
||||
// }
|
||||
//
|
||||
// protected override IEnumerable<IAttribute> GetAssemblyAttributes(Assembly assembly)
|
||||
// {
|
||||
// var pc = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], AssemblyParserService.DefaultProjectContentRegistry);
|
||||
// pc.AddAssemblyAttributes(assembly);
|
||||
// return pc.GetAssemblyAttributes();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// [TestFixture]
|
||||
// public class ReflectionWithRoundTripLayerTests : ReflectionOrCecilLayerTests
|
||||
// {
|
||||
// public ReflectionWithRoundTripLayerTests()
|
||||
// {
|
||||
// mscorlib = AssemblyParserService.DefaultProjectContentRegistry.Mscorlib;
|
||||
//
|
||||
// MemoryStream memory = new MemoryStream();
|
||||
// DomPersistence.WriteProjectContent((ReflectionProjectContent)mscorlib, memory);
|
||||
// memory.Position = 0;
|
||||
// mscorlib = DomPersistence.LoadProjectContent(memory, AssemblyParserService.DefaultProjectContentRegistry);
|
||||
// }
|
||||
//
|
||||
// protected override IClass GetClass(Type type)
|
||||
// {
|
||||
// ICompilationUnit cu = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], AssemblyParserService.DefaultProjectContentRegistry).AssemblyCompilationUnit;
|
||||
// IClass c = new ReflectionClass(cu, type, type.FullName, null);
|
||||
// cu.ProjectContent.AddClassToNamespaceList(c);
|
||||
//
|
||||
// MemoryStream memory = new MemoryStream();
|
||||
// DomPersistence.WriteProjectContent((ReflectionProjectContent)c.ProjectContent, memory);
|
||||
//
|
||||
// memory.Position = 0;
|
||||
// ReflectionProjectContent loadedPC = DomPersistence.LoadProjectContent(memory, AssemblyParserService.DefaultProjectContentRegistry);
|
||||
// loadedPC.AddReferencedContent(mscorlib);
|
||||
// return loadedPC.Classes.Single();
|
||||
// }
|
||||
//
|
||||
// protected override IEnumerable<IAttribute> GetAssemblyAttributes(Assembly assembly)
|
||||
// {
|
||||
// var pc = new ReflectionProjectContent("TestName", "testlocation", new DomAssemblyName[0], AssemblyParserService.DefaultProjectContentRegistry);
|
||||
// pc.AddAssemblyAttributes(assembly);
|
||||
//
|
||||
// MemoryStream memory = new MemoryStream();
|
||||
// DomPersistence.WriteProjectContent(pc, memory);
|
||||
//
|
||||
// memory.Position = 0;
|
||||
// return DomPersistence.LoadProjectContent(memory, AssemblyParserService.DefaultProjectContentRegistry).GetAssemblyAttributes();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// [TestFixture]
|
||||
// public class CecilLayerTests : ReflectionOrCecilLayerTests
|
||||
// {
|
||||
// public CecilLayerTests()
|
||||
// {
|
||||
// mscorlib = CecilReader.LoadAssembly(typeof(object).Assembly.Location, AssemblyParserService.DefaultProjectContentRegistry);
|
||||
// }
|
||||
//
|
||||
// IProjectContent LoadAssembly(Assembly assembly)
|
||||
// {
|
||||
// var pc = CecilReader.LoadAssembly(assembly.Location, AssemblyParserService.DefaultProjectContentRegistry);
|
||||
// Assert.IsNotNull(pc);
|
||||
// pc.AddReferencedContent(mscorlib);
|
||||
// return pc;
|
||||
// }
|
||||
//
|
||||
// protected override IClass GetClass(Type type)
|
||||
// {
|
||||
// IClass c = LoadAssembly(type.Assembly).GetClassByReflectionName(type.FullName, false);
|
||||
// Assert.IsNotNull(c);
|
||||
// return c;
|
||||
// }
|
||||
//
|
||||
// protected override IEnumerable<IAttribute> GetAssemblyAttributes(Assembly assembly)
|
||||
// {
|
||||
// return LoadAssembly(assembly).GetAssemblyAttributes();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public abstract class ReflectionOrCecilLayerTests
|
||||
// {
|
||||
// protected IProjectContent mscorlib;
|
||||
//
|
||||
// [Test]
|
||||
// public void InheritanceTest()
|
||||
// {
|
||||
// IClass c = mscorlib.GetClass("System.SystemException", 0);
|
||||
// IClass c2 = mscorlib.GetClass("System.Exception", 0);
|
||||
// Assert.IsNotNull(c, "c is null");
|
||||
// Assert.IsNotNull(c2, "c2 is null");
|
||||
// //Assert.AreEqual(3, c.BaseTypes.Count); // Inherited interfaces are not reported by Cecil
|
||||
// // which matches the behaviour of our C#/VB parsers
|
||||
// Assert.AreEqual("System.Exception", c.BaseTypes[0].FullyQualifiedName);
|
||||
// Assert.AreSame(c2, c.BaseClass);
|
||||
//
|
||||
// List<IClass> subClasses = new List<IClass>();
|
||||
// foreach (IClass subClass in c.ClassInheritanceTree) {
|
||||
// subClasses.Add(subClass);
|
||||
// }
|
||||
// Assert.AreEqual(5, subClasses.Count, "ClassInheritanceTree length");
|
||||
// Assert.AreEqual("System.SystemException", subClasses[0].FullyQualifiedName);
|
||||
// Assert.AreEqual("System.Exception", subClasses[1].FullyQualifiedName);
|
||||
// if (subClasses[2].FullyQualifiedName == "System.Object") {
|
||||
// Assert.AreEqual("System.Object", subClasses[2].FullyQualifiedName);
|
||||
// Assert.AreEqual("System.Runtime.Serialization.ISerializable", subClasses[3].FullyQualifiedName);
|
||||
// Assert.AreEqual("System.Runtime.InteropServices._Exception", subClasses[4].FullyQualifiedName);
|
||||
// } else {
|
||||
// Assert.AreEqual("System.Runtime.Serialization.ISerializable", subClasses[2].FullyQualifiedName);
|
||||
// Assert.AreEqual("System.Runtime.InteropServices._Exception", subClasses[3].FullyQualifiedName);
|
||||
// Assert.AreEqual("System.Object", subClasses[4].FullyQualifiedName);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GenericPropertyTest()
|
||||
// {
|
||||
// IClass c = mscorlib.GetClass("System.Collections.Generic.Comparer", 1);
|
||||
// IProperty def = c.Properties.First(p => p.Name == "Default");
|
||||
// ConstructedReturnType crt = def.ReturnType.CastToConstructedReturnType();
|
||||
// Assert.AreEqual("System.Collections.Generic.Comparer", crt.FullyQualifiedName);
|
||||
// Assert.IsTrue(crt.TypeArguments[0].IsGenericReturnType);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void PointerTypeTest()
|
||||
// {
|
||||
// IClass c = mscorlib.GetClass("System.IntPtr", 1);
|
||||
// IMethod toPointer = c.Methods.First(p => p.Name == "ToPointer");
|
||||
// Assert.AreEqual("System.Void*", toPointer.ReturnType.DotNetName);
|
||||
// PointerReturnType prt = toPointer.ReturnType.CastToDecoratingReturnType<PointerReturnType>();
|
||||
// Assert.AreEqual("System.Void", prt.BaseType.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void DateTimeDefaultConstructor()
|
||||
// {
|
||||
// IClass c = mscorlib.GetClass("System.DateTime", 0);
|
||||
// Assert.IsFalse(c.Methods.Any(p => p.IsConstructor && p.Parameters.Count == 0));
|
||||
// Assert.IsTrue(c.AddDefaultConstructorIfRequired);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void NoEncodingInfoDefaultConstructor()
|
||||
// {
|
||||
// IClass c = mscorlib.GetClass("System.Text.EncodingInfo", 0);
|
||||
// Assert.IsFalse(c.Methods.Any(p => p.IsConstructor)); // EncodingInfo only has an internal constructor
|
||||
// Assert.IsFalse(c.AddDefaultConstructorIfRequired);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ParameterComparisonTest()
|
||||
// {
|
||||
// DefaultParameter p1 = new DefaultParameter("a", mscorlib.GetClass("System.String", 0).DefaultReturnType, DomRegion.Empty);
|
||||
// DefaultParameter p2 = new DefaultParameter("b", new GetClassReturnType(mscorlib, "System.String", 0), DomRegion.Empty);
|
||||
// IList<IParameter> a1 = new List<IParameter>();
|
||||
// IList<IParameter> a2 = new List<IParameter>();
|
||||
// a1.Add(p1);
|
||||
// a2.Add(p2);
|
||||
// Assert.AreEqual(0, DiffUtility.Compare(a1, a2));
|
||||
// }
|
||||
//
|
||||
// DefaultMethod GetMethod(IClass c, string name)
|
||||
// {
|
||||
// IMethod result = c.Methods.FirstOrDefault(m => m.Name == name);
|
||||
// Assert.IsNotNull(result, "Method " + name + " not found");
|
||||
// return (DefaultMethod)result;
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GenericDocumentationTagNamesTest()
|
||||
// {
|
||||
// DefaultClass c = (DefaultClass)mscorlib.GetClass("System.Collections.Generic.List", 1);
|
||||
// Assert.AreEqual("T:System.Collections.Generic.List`1",
|
||||
// c.DocumentationTag);
|
||||
// Assert.AreEqual("M:System.Collections.Generic.List`1.Add(`0)",
|
||||
// GetMethod(c, "Add").DocumentationTag);
|
||||
// Assert.AreEqual("M:System.Collections.Generic.List`1.AddRange(System.Collections.Generic.IEnumerable{`0})",
|
||||
// GetMethod(c, "AddRange").DocumentationTag);
|
||||
// Assert.AreEqual("M:System.Collections.Generic.List`1.ConvertAll``1(System.Converter{`0,``0})",
|
||||
// GetMethod(c, "ConvertAll").DocumentationTag);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void StaticModifierTest()
|
||||
// {
|
||||
// IClass c = mscorlib.GetClass("System.Environment", 0);
|
||||
// Assert.IsNotNull(c, "System.Environment not found");
|
||||
// Assert.IsTrue(c.IsAbstract, "class should be abstract");
|
||||
// Assert.IsTrue(c.IsSealed, "class should be sealed");
|
||||
// Assert.IsTrue(c.IsStatic, "class should be static");
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void InnerClassReferenceTest()
|
||||
// {
|
||||
// IClass c = mscorlib.GetClass("System.Environment", 0);
|
||||
// Assert.IsNotNull(c, "System.Environment not found");
|
||||
// IReturnType rt = GetMethod(c, "GetFolderPath").Parameters[0].ReturnType;
|
||||
// Assert.IsNotNull(rt, "ReturnType is null");
|
||||
// Assert.AreEqual("System.Environment.SpecialFolder", rt.FullyQualifiedName);
|
||||
// IClass inner = rt.GetUnderlyingClass();
|
||||
// Assert.IsNotNull(inner, "UnderlyingClass");
|
||||
// Assert.AreEqual("System.Environment.SpecialFolder", inner.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void InnerClassesTest()
|
||||
// {
|
||||
// IClass c = mscorlib.GetClass("System.Environment.SpecialFolder", 0);
|
||||
// Assert.IsNotNull(c, "c is null");
|
||||
// Assert.AreEqual("System.Environment.SpecialFolder", c.FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void VoidTest()
|
||||
// {
|
||||
// IClass c = mscorlib.GetClass("System.Void", 0);
|
||||
// Assert.IsNotNull(c, "System.Void not found");
|
||||
// Assert.AreSame(c.DefaultReturnType, mscorlib.SystemTypes.Void, "pc.SystemTypes.Void is c.DefaultReturnType");
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void NestedClassInGenericClassTest()
|
||||
// {
|
||||
// IClass dictionary = mscorlib.GetClass("System.Collections.Generic.Dictionary", 2);
|
||||
// Assert.IsNotNull(dictionary);
|
||||
// IClass valueCollection = mscorlib.GetClass("System.Collections.Generic.Dictionary.ValueCollection", 2);
|
||||
// Assert.IsNotNull(valueCollection);
|
||||
// var dictionaryRT = new ConstructedReturnType(dictionary.DefaultReturnType, new[] { mscorlib.SystemTypes.String, mscorlib.SystemTypes.Int32 });
|
||||
// IProperty valueProperty = dictionaryRT.GetProperties().Find(p => p.Name == "Values");
|
||||
// Assert.AreSame(valueCollection, valueProperty.ReturnType.GetUnderlyingClass());
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ValueCollectionCountModifiers()
|
||||
// {
|
||||
// IClass valueCollection = mscorlib.GetClass("System.Collections.Generic.Dictionary.ValueCollection", 2);
|
||||
// Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Sealed, valueCollection.Modifiers);
|
||||
// IProperty count = valueCollection.Properties.Single(p => p.Name == "Count");
|
||||
// Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Sealed, count.Modifiers);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void MathAcosModifiers()
|
||||
// {
|
||||
// IClass math = mscorlib.GetClass("System.Math", 0);
|
||||
// Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Abstract | ModifierEnum.Sealed | ModifierEnum.Static, math.Modifiers);
|
||||
// IMethod acos = math.Methods.Single(p => p.Name == "Acos");
|
||||
// Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Static, acos.Modifiers);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void EncodingModifiers()
|
||||
// {
|
||||
// IClass encoding = mscorlib.GetClass("System.Text.Encoding", 0);
|
||||
// Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Abstract, encoding.Modifiers);
|
||||
// IMethod getDecoder = encoding.Methods.Single(p => p.Name == "GetDecoder");
|
||||
// Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Virtual, getDecoder.Modifiers);
|
||||
// IMethod getMaxByteCount = encoding.Methods.Single(p => p.Name == "GetMaxByteCount");
|
||||
// Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Abstract, getMaxByteCount.Modifiers);
|
||||
// IProperty encoderFallback = encoding.Properties.Single(p => p.Name == "EncoderFallback");
|
||||
// Assert.AreEqual(ModifierEnum.Public, encoderFallback.Modifiers);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void UnicodeEncodingModifiers()
|
||||
// {
|
||||
// IClass encoding = mscorlib.GetClass("System.Text.UnicodeEncoding", 0);
|
||||
// Assert.AreEqual(ModifierEnum.Public, encoding.Modifiers);
|
||||
// IMethod getDecoder = encoding.Methods.Single(p => p.Name == "GetDecoder");
|
||||
// Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Override, getDecoder.Modifiers);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void UTF32EncodingModifiers()
|
||||
// {
|
||||
// IClass encoding = mscorlib.GetClass("System.Text.UTF32Encoding", 0);
|
||||
// Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Sealed, encoding.Modifiers);
|
||||
// IMethod getDecoder = encoding.Methods.Single(p => p.Name == "GetDecoder");
|
||||
// Assert.AreEqual(ModifierEnum.Public | ModifierEnum.Override, getDecoder.Modifiers);
|
||||
// }
|
||||
//
|
||||
// public class TestClass<A, B> where A : B {
|
||||
// public void TestMethod<K, V>(string param) where V: K where K: IComparable {}
|
||||
//
|
||||
// public void GetIndex<T>(T element) where T: IEquatable<T> {}
|
||||
//
|
||||
// public int Property { get; protected set; }
|
||||
// public dynamic ReadOnlyPropertyWithPrivateSetter { get; private set; }
|
||||
//
|
||||
// public List<dynamic> DynamicGenerics1(Action<object, dynamic[], object> param) { return null; }
|
||||
// public void DynamicGenerics2(Action<object, dynamic, object> param) { }
|
||||
// public void DynamicGenerics3(Action<int, dynamic, object> param) { }
|
||||
// public void DynamicGenerics4(Action<int[], dynamic, object> param) { }
|
||||
// public void DynamicGenerics5(Action<int*[], dynamic, object> param) { }
|
||||
// }
|
||||
//
|
||||
// protected abstract IClass GetClass(Type type);
|
||||
// protected abstract IEnumerable<IAttribute> GetAssemblyAttributes(Assembly assembly);
|
||||
//
|
||||
// IClass testClass;
|
||||
//
|
||||
// [TestFixtureSetUp]
|
||||
// public void FixtureSetUp()
|
||||
// {
|
||||
// testClass = GetClass(typeof(TestClass<,>));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void TestClassTypeParameters()
|
||||
// {
|
||||
// Assert.AreSame(testClass, testClass.TypeParameters[0].Class);
|
||||
// Assert.AreSame(testClass, testClass.TypeParameters[1].Class);
|
||||
// Assert.AreSame(testClass.TypeParameters[1], ((GenericReturnType)testClass.TypeParameters[0].Constraints[0]).TypeParameter);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void TestMethod()
|
||||
// {
|
||||
// IMethod m = testClass.Methods.Single(me => me.Name == "TestMethod");
|
||||
// Assert.AreEqual("K", m.TypeParameters[0].Name);
|
||||
// Assert.AreEqual("V", m.TypeParameters[1].Name);
|
||||
// Assert.AreSame(m, m.TypeParameters[0].Method);
|
||||
// Assert.AreSame(m, m.TypeParameters[1].Method);
|
||||
//
|
||||
// Assert.AreEqual("IComparable", m.TypeParameters[0].Constraints[0].Name);
|
||||
// GenericReturnType kConst = (GenericReturnType)m.TypeParameters[1].Constraints[0];
|
||||
// Assert.AreSame(m.TypeParameters[0], kConst.TypeParameter);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void GetIndex()
|
||||
// {
|
||||
// IMethod m = testClass.Methods.Single(me => me.Name == "GetIndex");
|
||||
// Assert.AreEqual("T", m.TypeParameters[0].Name);
|
||||
// Assert.AreSame(m, m.TypeParameters[0].Method);
|
||||
//
|
||||
// Assert.AreEqual("IEquatable", m.TypeParameters[0].Constraints[0].Name);
|
||||
// Assert.AreEqual(1, m.TypeParameters[0].Constraints[0].TypeArgumentCount);
|
||||
// Assert.AreEqual(1, m.TypeParameters[0].Constraints[0].CastToConstructedReturnType().TypeArguments.Count);
|
||||
// GenericReturnType grt = (GenericReturnType)m.TypeParameters[0].Constraints[0].CastToConstructedReturnType().TypeArguments[0];
|
||||
// Assert.AreSame(m.TypeParameters[0], grt.TypeParameter);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void Property()
|
||||
// {
|
||||
// IProperty p = testClass.Properties.Single(pr => pr.Name == "Property");
|
||||
// Assert.AreEqual(ModifierEnum.Public, p.Modifiers);
|
||||
// Assert.AreEqual(ModifierEnum.None, p.GetterModifiers);
|
||||
// Assert.AreEqual(ModifierEnum.Protected, p.SetterModifiers);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void CannotSetReadOnlyProperty()
|
||||
// {
|
||||
// IProperty p = testClass.Properties.Single(pr => pr.Name == "ReadOnlyPropertyWithPrivateSetter");
|
||||
// Assert.AreEqual(ModifierEnum.Public, p.Modifiers);
|
||||
// Assert.AreEqual(ModifierEnum.None, p.GetterModifiers);
|
||||
// Assert.IsFalse(p.CanSet);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void DynamicType()
|
||||
// {
|
||||
// IProperty p = testClass.Properties.Single(pr => pr.Name == "ReadOnlyPropertyWithPrivateSetter");
|
||||
// Assert.IsInstanceOf(typeof(DynamicReturnType), p.ReturnType);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void DynamicTypeInGenerics()
|
||||
// {
|
||||
// CSharpAmbience a = new CSharpAmbience();
|
||||
// a.ConversionFlags = ConversionFlags.ShowReturnType | ConversionFlags.ShowParameterList;
|
||||
// Assert.AreEqual("List<dynamic> DynamicGenerics1(Action<object, dynamic[], object>)", a.Convert(testClass.Methods.Single(me => me.Name == "DynamicGenerics1")));
|
||||
// Assert.AreEqual("void DynamicGenerics2(Action<object, dynamic, object>)", a.Convert(testClass.Methods.Single(me => me.Name == "DynamicGenerics2")));
|
||||
// Assert.AreEqual("void DynamicGenerics3(Action<int, dynamic, object>)", a.Convert(testClass.Methods.Single(me => me.Name == "DynamicGenerics3")));
|
||||
// Assert.AreEqual("void DynamicGenerics4(Action<int[], dynamic, object>)", a.Convert(testClass.Methods.Single(me => me.Name == "DynamicGenerics4")));
|
||||
// Assert.AreEqual("void DynamicGenerics5(Action<Int32*[], dynamic, object>)", a.Convert(testClass.Methods.Single(me => me.Name == "DynamicGenerics5")));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void AssemblyAttribute()
|
||||
// {
|
||||
// var attributes = GetAssemblyAttributes(typeof(TypeTestAttribute).Assembly);
|
||||
// var typeTest = attributes.First(a => a.AttributeType.FullyQualifiedName == typeof(TypeTestAttribute).FullName);
|
||||
// Assert.AreEqual(3, typeTest.PositionalArguments.Count);
|
||||
// // first argument is (int)42
|
||||
// Assert.AreEqual(42, (int)typeTest.PositionalArguments[0]);
|
||||
// // second argument is typeof(System.Action<>)
|
||||
// IReturnType rt = (IReturnType)typeTest.PositionalArguments[1];
|
||||
// Assert.IsNull(rt.CastToConstructedReturnType()); // rt must not be constructed - it's just an unbound type
|
||||
// Assert.AreEqual("System.Action", rt.FullyQualifiedName);
|
||||
// Assert.AreEqual(1, rt.TypeArgumentCount);
|
||||
// // third argument is typeof(IDictionary<string, IList<TestAttribute>>)
|
||||
// ConstructedReturnType crt = ((IReturnType)typeTest.PositionalArguments[2]).CastToConstructedReturnType();
|
||||
// Assert.AreEqual("System.Collections.Generic.IDictionary", crt.FullyQualifiedName);
|
||||
// Assert.AreEqual("System.String", crt.TypeArguments[0].FullyQualifiedName);
|
||||
// Assert.AreEqual("System.Collections.Generic.IList{NUnit.Framework.TestAttribute}", crt.TypeArguments[1].DotNetName);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,173 +1,173 @@
@@ -1,173 +1,173 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class SearchClassTests |
||||
{ |
||||
ProjectContentRegistry projectContentRegistry = AssemblyParserService.DefaultProjectContentRegistry; |
||||
|
||||
#region Helper methods
|
||||
ICompilationUnit Prepare(LanguageProperties language) |
||||
{ |
||||
DefaultProjectContent pc = new DefaultProjectContent(); |
||||
pc.ReferencedContents.Add(projectContentRegistry.Mscorlib); |
||||
pc.Language = language; |
||||
DefaultCompilationUnit cu = new DefaultCompilationUnit(pc); |
||||
if (language == LanguageProperties.VBNet) |
||||
cu.UsingScope.Usings.Add(CreateUsing(pc, "syStEm")); |
||||
else |
||||
cu.UsingScope.Usings.Add(CreateUsing(pc, "System")); |
||||
return cu; |
||||
} |
||||
|
||||
IUsing CreateUsing(IProjectContent pc, string @namespace) |
||||
{ |
||||
DefaultUsing @using = new DefaultUsing(pc); |
||||
@using.Usings.Add(@namespace); |
||||
return @using; |
||||
} |
||||
|
||||
IReturnType SearchType(string type) |
||||
{ |
||||
ICompilationUnit cu = Prepare(LanguageProperties.CSharp); |
||||
IReturnType c = cu.ProjectContent.SearchType(new SearchTypeRequest(type, 0, null, cu, 1, 1)).Result; |
||||
Assert.IsNotNull(c, type + "not found"); |
||||
return c; |
||||
} |
||||
|
||||
IReturnType SearchTypeVB(string type) |
||||
{ |
||||
ICompilationUnit cu = Prepare(LanguageProperties.VBNet); |
||||
IReturnType c = cu.ProjectContent.SearchType(new SearchTypeRequest(type, 0, null, cu, 1, 1)).Result; |
||||
Assert.IsNotNull(c, type + "not found"); |
||||
return c; |
||||
} |
||||
|
||||
void CheckNamespace(string @namespace, string className) |
||||
{ |
||||
CheckNamespace(@namespace, className, LanguageProperties.CSharp); |
||||
} |
||||
|
||||
void CheckNamespaceVB(string @namespace, string className) |
||||
{ |
||||
CheckNamespace(@namespace, className, LanguageProperties.VBNet); |
||||
} |
||||
|
||||
void CheckNamespace(string @namespace, string className, LanguageProperties language) |
||||
{ |
||||
ICompilationUnit cu = Prepare(language); |
||||
string ns = cu.ProjectContent.SearchType(new SearchTypeRequest(@namespace, 0, null, cu, 1, 1)).NamespaceResult; |
||||
Assert.IsNotNull(ns, @namespace + " not found"); |
||||
foreach (object o in cu.ProjectContent.GetNamespaceContents(ns)) { |
||||
IClass c = o as IClass; |
||||
if (c != null && c.Name == className) |
||||
return; |
||||
} |
||||
} |
||||
#endregion
|
||||
|
||||
[Test] |
||||
public void SearchFullyQualifiedClass() |
||||
{ |
||||
Assert.AreEqual("System.Reflection.Assembly", SearchType("System.Reflection.Assembly").FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void SearchFullyQualifiedClassVB() |
||||
{ |
||||
Assert.AreEqual("System.Reflection.Assembly", SearchTypeVB("SYStem.RefleCtion.asSembly").FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void SearchFullyQualifiedNamespace() |
||||
{ |
||||
CheckNamespace("System.Collections.Generic", "KeyNotFoundException"); |
||||
} |
||||
|
||||
[Test] |
||||
public void SearchFullyQualifiedNamespaceVB() |
||||
{ |
||||
CheckNamespaceVB("SyStem.COllEctions.GeNEric", "KeyNotFoundException"); |
||||
} |
||||
|
||||
[Test] |
||||
public void SearchEnvironment() |
||||
{ |
||||
Assert.AreEqual("System.Environment", SearchType("Environment").FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void SearchEnvironmentVB() |
||||
{ |
||||
Assert.AreEqual("System.Environment", SearchTypeVB("EnVIroNmEnt").FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void SearchArrayList() |
||||
{ |
||||
ICompilationUnit cu = Prepare(LanguageProperties.CSharp); |
||||
IReturnType c = cu.ProjectContent.SearchType(new SearchTypeRequest("Collections.ArrayList", 0, null, cu, 1, 1)).Result; |
||||
Assert.IsNull(c, "Namespaces should not be imported in C#"); |
||||
} |
||||
|
||||
[Test] |
||||
public void SearchArrayListVB() |
||||
{ |
||||
Assert.AreEqual("System.Collections.ArrayList", SearchTypeVB("CoLLections.ArrAyLiSt").FullyQualifiedName); |
||||
} |
||||
|
||||
[Test] |
||||
public void SearchNestedNamespace() |
||||
{ |
||||
ICompilationUnit cu = Prepare(LanguageProperties.CSharp); |
||||
string ns = cu.ProjectContent.SearchType(new SearchTypeRequest("Collections.Generic", 0, null, cu, 1, 1)).NamespaceResult; |
||||
Assert.IsNull(ns, "Nested namespaces should not be found in C#"); |
||||
} |
||||
|
||||
[Test] |
||||
public void SearchNestedNamespaceVB() |
||||
{ |
||||
CheckNamespaceVB("COllEctions.GeNEric", "KeyNotFoundException"); |
||||
} |
||||
|
||||
[Test] |
||||
public void SearchClassPreferVisible() |
||||
{ |
||||
ICompilationUnit ref1 = Prepare(LanguageProperties.CSharp); |
||||
ref1.ProjectContent.AddClassToNamespaceList(new DefaultClass(ref1, "ClassName") { Modifiers = ModifierEnum.Internal }); |
||||
ICompilationUnit ref2 = Prepare(LanguageProperties.CSharp); |
||||
ref2.ProjectContent.AddClassToNamespaceList(new DefaultClass(ref2, "ClassName") { Modifiers = ModifierEnum.Public }); |
||||
|
||||
ICompilationUnit cu = Prepare(LanguageProperties.CSharp); |
||||
cu.ProjectContent.ReferencedContents.Add(ref1.ProjectContent); |
||||
cu.ProjectContent.ReferencedContents.Add(ref2.ProjectContent); |
||||
|
||||
SearchTypeResult r = cu.ProjectContent.SearchType(new SearchTypeRequest("ClassName", 0, null, cu, 1, 1)); |
||||
Assert.AreEqual(ModifierEnum.Public, r.Result.GetUnderlyingClass().Modifiers); |
||||
} |
||||
|
||||
[Test] |
||||
public void SearchClassDifferentNamespacePreferVisible() |
||||
{ |
||||
ICompilationUnit ref1 = Prepare(LanguageProperties.CSharp); |
||||
ref1.ProjectContent.AddClassToNamespaceList(new DefaultClass(ref1, "NS1.ClassName") { Modifiers = ModifierEnum.Internal }); |
||||
ICompilationUnit ref2 = Prepare(LanguageProperties.CSharp); |
||||
ref2.ProjectContent.AddClassToNamespaceList(new DefaultClass(ref2, "NS2.ClassName") { Modifiers = ModifierEnum.Public }); |
||||
|
||||
ICompilationUnit cu = Prepare(LanguageProperties.CSharp); |
||||
cu.ProjectContent.ReferencedContents.Add(ref1.ProjectContent); |
||||
cu.ProjectContent.ReferencedContents.Add(ref2.ProjectContent); |
||||
cu.UsingScope.Usings.Add(new DefaultUsing(cu.ProjectContent) { Usings = { "NS1", "NS2" } }); |
||||
|
||||
SearchTypeResult r = cu.ProjectContent.SearchType(new SearchTypeRequest("ClassName", 0, null, cu, 1, 1)); |
||||
Assert.AreEqual(ModifierEnum.Public, r.Result.GetUnderlyingClass().Modifiers); |
||||
} |
||||
} |
||||
} |
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// [TestFixture]
|
||||
// public class SearchClassTests
|
||||
// {
|
||||
// ProjectContentRegistry projectContentRegistry = AssemblyParserService.DefaultProjectContentRegistry;
|
||||
//
|
||||
// #region Helper methods
|
||||
// ICompilationUnit Prepare(LanguageProperties language)
|
||||
// {
|
||||
// DefaultProjectContent pc = new DefaultProjectContent();
|
||||
// pc.ReferencedContents.Add(projectContentRegistry.Mscorlib);
|
||||
// pc.Language = language;
|
||||
// DefaultCompilationUnit cu = new DefaultCompilationUnit(pc);
|
||||
// if (language == LanguageProperties.VBNet)
|
||||
// cu.UsingScope.Usings.Add(CreateUsing(pc, "syStEm"));
|
||||
// else
|
||||
// cu.UsingScope.Usings.Add(CreateUsing(pc, "System"));
|
||||
// return cu;
|
||||
// }
|
||||
//
|
||||
// IUsing CreateUsing(IProjectContent pc, string @namespace)
|
||||
// {
|
||||
// DefaultUsing @using = new DefaultUsing(pc);
|
||||
// @using.Usings.Add(@namespace);
|
||||
// return @using;
|
||||
// }
|
||||
//
|
||||
// IReturnType SearchType(string type)
|
||||
// {
|
||||
// ICompilationUnit cu = Prepare(LanguageProperties.CSharp);
|
||||
// IReturnType c = cu.ProjectContent.SearchType(new SearchTypeRequest(type, 0, null, cu, 1, 1)).Result;
|
||||
// Assert.IsNotNull(c, type + "not found");
|
||||
// return c;
|
||||
// }
|
||||
//
|
||||
// IReturnType SearchTypeVB(string type)
|
||||
// {
|
||||
// ICompilationUnit cu = Prepare(LanguageProperties.VBNet);
|
||||
// IReturnType c = cu.ProjectContent.SearchType(new SearchTypeRequest(type, 0, null, cu, 1, 1)).Result;
|
||||
// Assert.IsNotNull(c, type + "not found");
|
||||
// return c;
|
||||
// }
|
||||
//
|
||||
// void CheckNamespace(string @namespace, string className)
|
||||
// {
|
||||
// CheckNamespace(@namespace, className, LanguageProperties.CSharp);
|
||||
// }
|
||||
//
|
||||
// void CheckNamespaceVB(string @namespace, string className)
|
||||
// {
|
||||
// CheckNamespace(@namespace, className, LanguageProperties.VBNet);
|
||||
// }
|
||||
//
|
||||
// void CheckNamespace(string @namespace, string className, LanguageProperties language)
|
||||
// {
|
||||
// ICompilationUnit cu = Prepare(language);
|
||||
// string ns = cu.ProjectContent.SearchType(new SearchTypeRequest(@namespace, 0, null, cu, 1, 1)).NamespaceResult;
|
||||
// Assert.IsNotNull(ns, @namespace + " not found");
|
||||
// foreach (object o in cu.ProjectContent.GetNamespaceContents(ns)) {
|
||||
// IClass c = o as IClass;
|
||||
// if (c != null && c.Name == className)
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// #endregion
|
||||
//
|
||||
// [Test]
|
||||
// public void SearchFullyQualifiedClass()
|
||||
// {
|
||||
// Assert.AreEqual("System.Reflection.Assembly", SearchType("System.Reflection.Assembly").FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SearchFullyQualifiedClassVB()
|
||||
// {
|
||||
// Assert.AreEqual("System.Reflection.Assembly", SearchTypeVB("SYStem.RefleCtion.asSembly").FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SearchFullyQualifiedNamespace()
|
||||
// {
|
||||
// CheckNamespace("System.Collections.Generic", "KeyNotFoundException");
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SearchFullyQualifiedNamespaceVB()
|
||||
// {
|
||||
// CheckNamespaceVB("SyStem.COllEctions.GeNEric", "KeyNotFoundException");
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SearchEnvironment()
|
||||
// {
|
||||
// Assert.AreEqual("System.Environment", SearchType("Environment").FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SearchEnvironmentVB()
|
||||
// {
|
||||
// Assert.AreEqual("System.Environment", SearchTypeVB("EnVIroNmEnt").FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SearchArrayList()
|
||||
// {
|
||||
// ICompilationUnit cu = Prepare(LanguageProperties.CSharp);
|
||||
// IReturnType c = cu.ProjectContent.SearchType(new SearchTypeRequest("Collections.ArrayList", 0, null, cu, 1, 1)).Result;
|
||||
// Assert.IsNull(c, "Namespaces should not be imported in C#");
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SearchArrayListVB()
|
||||
// {
|
||||
// Assert.AreEqual("System.Collections.ArrayList", SearchTypeVB("CoLLections.ArrAyLiSt").FullyQualifiedName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SearchNestedNamespace()
|
||||
// {
|
||||
// ICompilationUnit cu = Prepare(LanguageProperties.CSharp);
|
||||
// string ns = cu.ProjectContent.SearchType(new SearchTypeRequest("Collections.Generic", 0, null, cu, 1, 1)).NamespaceResult;
|
||||
// Assert.IsNull(ns, "Nested namespaces should not be found in C#");
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SearchNestedNamespaceVB()
|
||||
// {
|
||||
// CheckNamespaceVB("COllEctions.GeNEric", "KeyNotFoundException");
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SearchClassPreferVisible()
|
||||
// {
|
||||
// ICompilationUnit ref1 = Prepare(LanguageProperties.CSharp);
|
||||
// ref1.ProjectContent.AddClassToNamespaceList(new DefaultClass(ref1, "ClassName") { Modifiers = ModifierEnum.Internal });
|
||||
// ICompilationUnit ref2 = Prepare(LanguageProperties.CSharp);
|
||||
// ref2.ProjectContent.AddClassToNamespaceList(new DefaultClass(ref2, "ClassName") { Modifiers = ModifierEnum.Public });
|
||||
//
|
||||
// ICompilationUnit cu = Prepare(LanguageProperties.CSharp);
|
||||
// cu.ProjectContent.ReferencedContents.Add(ref1.ProjectContent);
|
||||
// cu.ProjectContent.ReferencedContents.Add(ref2.ProjectContent);
|
||||
//
|
||||
// SearchTypeResult r = cu.ProjectContent.SearchType(new SearchTypeRequest("ClassName", 0, null, cu, 1, 1));
|
||||
// Assert.AreEqual(ModifierEnum.Public, r.Result.GetUnderlyingClass().Modifiers);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void SearchClassDifferentNamespacePreferVisible()
|
||||
// {
|
||||
// ICompilationUnit ref1 = Prepare(LanguageProperties.CSharp);
|
||||
// ref1.ProjectContent.AddClassToNamespaceList(new DefaultClass(ref1, "NS1.ClassName") { Modifiers = ModifierEnum.Internal });
|
||||
// ICompilationUnit ref2 = Prepare(LanguageProperties.CSharp);
|
||||
// ref2.ProjectContent.AddClassToNamespaceList(new DefaultClass(ref2, "NS2.ClassName") { Modifiers = ModifierEnum.Public });
|
||||
//
|
||||
// ICompilationUnit cu = Prepare(LanguageProperties.CSharp);
|
||||
// cu.ProjectContent.ReferencedContents.Add(ref1.ProjectContent);
|
||||
// cu.ProjectContent.ReferencedContents.Add(ref2.ProjectContent);
|
||||
// cu.UsingScope.Usings.Add(new DefaultUsing(cu.ProjectContent) { Usings = { "NS1", "NS2" } });
|
||||
//
|
||||
// SearchTypeResult r = cu.ProjectContent.SearchType(new SearchTypeRequest("ClassName", 0, null, cu, 1, 1));
|
||||
// Assert.AreEqual(ModifierEnum.Public, r.Result.GetUnderlyingClass().Modifiers);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,117 +1,118 @@
@@ -1,117 +1,118 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class SearchGenericClassTests |
||||
{ |
||||
ProjectContentRegistry projectContentRegistry = AssemblyParserService.DefaultProjectContentRegistry; |
||||
|
||||
#region Helper methods
|
||||
// usingMode: 0 = one using-statement for each namespace (correctly cased)
|
||||
// 1 = mixture of using statements and default imports (incorrectly cased)
|
||||
// 2 = all default imports (incorrectly cased)
|
||||
ICompilationUnit Prepare(LanguageProperties language, int usingMode) |
||||
{ |
||||
DefaultProjectContent pc = new DefaultProjectContent(); |
||||
pc.ReferencedContents.Add(projectContentRegistry.Mscorlib); |
||||
pc.Language = language; |
||||
DefaultCompilationUnit cu = new DefaultCompilationUnit(pc); |
||||
if (usingMode == 1) { |
||||
cu.UsingScope.Usings.Add(CreateUsing(pc, "syStEm.coLLectIons")); |
||||
pc.DefaultImports = new DefaultUsing(pc); |
||||
pc.DefaultImports.Usings.Add("syStEm"); |
||||
pc.DefaultImports.Usings.Add("syStEm.coLLEctionS.GeNeRic"); |
||||
} else if (usingMode == 2) { |
||||
pc.DefaultImports = new DefaultUsing(pc); |
||||
pc.DefaultImports.Usings.Add("syStEm"); |
||||
pc.DefaultImports.Usings.Add("syStEm.coLLEctioNs"); |
||||
pc.DefaultImports.Usings.Add("syStEm.coLLEctionS.GeNeRic"); |
||||
} else { // usingMode == 0
|
||||
cu.UsingScope.Usings.Add(CreateUsing(pc, "System")); |
||||
cu.UsingScope.Usings.Add(CreateUsing(pc, "System.Collections")); |
||||
cu.UsingScope.Usings.Add(CreateUsing(pc, "System.Collections.Generic")); |
||||
} |
||||
return cu; |
||||
} |
||||
|
||||
IUsing CreateUsing(IProjectContent pc, string @namespace) |
||||
{ |
||||
DefaultUsing @using = new DefaultUsing(pc); |
||||
@using.Usings.Add(@namespace); |
||||
return @using; |
||||
} |
||||
|
||||
IReturnType SearchType(string type, int typeParameterCount) |
||||
{ |
||||
ICompilationUnit cu = Prepare(LanguageProperties.CSharp, 0); |
||||
IReturnType c = cu.ProjectContent.SearchType(new SearchTypeRequest(type, typeParameterCount, null, cu, 1, 1)).Result; |
||||
Assert.IsNotNull(c, type + "not found"); |
||||
return c; |
||||
} |
||||
|
||||
IReturnType SearchTypeVB(string type, int typeParameterCount) |
||||
{ |
||||
ICompilationUnit cu; |
||||
cu = Prepare(LanguageProperties.VBNet, 0); |
||||
IReturnType c0 = cu.ProjectContent.SearchType(new SearchTypeRequest(type, typeParameterCount, null, cu, 1, 1)).Result; |
||||
Assert.IsNotNull(c0, type + "not found for mode=0"); |
||||
|
||||
cu = Prepare(LanguageProperties.VBNet, 1); |
||||
IReturnType c1 = cu.ProjectContent.SearchType(new SearchTypeRequest(type, typeParameterCount, null, cu, 1, 1)).Result; |
||||
Assert.IsNotNull(c1, type + "not found for mode=1"); |
||||
|
||||
cu = Prepare(LanguageProperties.VBNet, 2); |
||||
IReturnType c2 = cu.ProjectContent.SearchType(new SearchTypeRequest(type, typeParameterCount, null, cu, 1, 1)).Result; |
||||
Assert.IsNotNull(c2, type + "not found for mode=2"); |
||||
|
||||
Assert.IsTrue(c0.Equals(c1) && c0.Equals(c2)); |
||||
|
||||
return c0; |
||||
} |
||||
|
||||
void CheckType(string shortName, string vbShortName, string fullType, int typeParameterCount) |
||||
{ |
||||
IReturnType type = SearchType(shortName, typeParameterCount); |
||||
Assert.AreEqual(fullType, type.FullyQualifiedName); |
||||
Assert.AreEqual(typeParameterCount, type.TypeArgumentCount); |
||||
type = SearchTypeVB(vbShortName, typeParameterCount); |
||||
Assert.AreEqual(fullType, type.FullyQualifiedName); |
||||
Assert.AreEqual(typeParameterCount, type.TypeArgumentCount); |
||||
} |
||||
#endregion
|
||||
|
||||
// EventHandler vs. EventHandler<TEventArgs>
|
||||
// both mscorlib, both namespace System
|
||||
[Test] public void FindEventHandler() { |
||||
CheckType("EventHandler", "EvEnThAndler", "System.EventHandler", 0); |
||||
} |
||||
[Test] public void FindGenericEventHandler() { |
||||
CheckType("EventHandler", "EvEnThAndler", "System.EventHandler", 1); |
||||
} |
||||
|
||||
|
||||
[Test] public void FindNullableClass() { |
||||
CheckType("Nullable", "NuLLable", "System.Nullable", 0); |
||||
} |
||||
[Test] public void FindNullableStruct() { |
||||
CheckType("Nullable", "NuLLable", "System.Nullable", 1); |
||||
} |
||||
|
||||
// ICollection vs. ICollection<T>
|
||||
// both mscorlib, different namespaces
|
||||
[Test] public void FindCollection() { |
||||
CheckType("ICollection", "IColLEction", "System.Collections.ICollection", 0); |
||||
} |
||||
[Test] public void FindGenericCollection() { |
||||
CheckType("ICollection", "IColLEction", "System.Collections.Generic.ICollection", 1); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using NUnit.Framework;
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests
|
||||
//{
|
||||
// [TestFixture]
|
||||
// public class SearchGenericClassTests
|
||||
// {
|
||||
// ProjectContentRegistry projectContentRegistry = AssemblyParserService.DefaultProjectContentRegistry;
|
||||
//
|
||||
// #region Helper methods
|
||||
// // usingMode: 0 = one using-statement for each namespace (correctly cased)
|
||||
// // 1 = mixture of using statements and default imports (incorrectly cased)
|
||||
// // 2 = all default imports (incorrectly cased)
|
||||
// ICompilationUnit Prepare(LanguageProperties language, int usingMode)
|
||||
// {
|
||||
// DefaultProjectContent pc = new DefaultProjectContent();
|
||||
// pc.ReferencedContents.Add(projectContentRegistry.Mscorlib);
|
||||
// pc.Language = language;
|
||||
// DefaultCompilationUnit cu = new DefaultCompilationUnit(pc);
|
||||
// if (usingMode == 1) {
|
||||
// cu.UsingScope.Usings.Add(CreateUsing(pc, "syStEm.coLLectIons"));
|
||||
// pc.DefaultImports = new DefaultUsing(pc);
|
||||
// pc.DefaultImports.Usings.Add("syStEm");
|
||||
// pc.DefaultImports.Usings.Add("syStEm.coLLEctionS.GeNeRic");
|
||||
// } else if (usingMode == 2) {
|
||||
// pc.DefaultImports = new DefaultUsing(pc);
|
||||
// pc.DefaultImports.Usings.Add("syStEm");
|
||||
// pc.DefaultImports.Usings.Add("syStEm.coLLEctioNs");
|
||||
// pc.DefaultImports.Usings.Add("syStEm.coLLEctionS.GeNeRic");
|
||||
// } else { // usingMode == 0
|
||||
// cu.UsingScope.Usings.Add(CreateUsing(pc, "System"));
|
||||
// cu.UsingScope.Usings.Add(CreateUsing(pc, "System.Collections"));
|
||||
// cu.UsingScope.Usings.Add(CreateUsing(pc, "System.Collections.Generic"));
|
||||
// }
|
||||
// return cu;
|
||||
// }
|
||||
//
|
||||
// IUsing CreateUsing(IProjectContent pc, string @namespace)
|
||||
// {
|
||||
// DefaultUsing @using = new DefaultUsing(pc);
|
||||
// @using.Usings.Add(@namespace);
|
||||
// return @using;
|
||||
// }
|
||||
//
|
||||
// IReturnType SearchType(string type, int typeParameterCount)
|
||||
// {
|
||||
// ICompilationUnit cu = Prepare(LanguageProperties.CSharp, 0);
|
||||
// IReturnType c = cu.ProjectContent.SearchType(new SearchTypeRequest(type, typeParameterCount, null, cu, 1, 1)).Result;
|
||||
// Assert.IsNotNull(c, type + "not found");
|
||||
// return c;
|
||||
// }
|
||||
//
|
||||
// IReturnType SearchTypeVB(string type, int typeParameterCount)
|
||||
// {
|
||||
// ICompilationUnit cu;
|
||||
// cu = Prepare(LanguageProperties.VBNet, 0);
|
||||
// IReturnType c0 = cu.ProjectContent.SearchType(new SearchTypeRequest(type, typeParameterCount, null, cu, 1, 1)).Result;
|
||||
// Assert.IsNotNull(c0, type + "not found for mode=0");
|
||||
//
|
||||
// cu = Prepare(LanguageProperties.VBNet, 1);
|
||||
// IReturnType c1 = cu.ProjectContent.SearchType(new SearchTypeRequest(type, typeParameterCount, null, cu, 1, 1)).Result;
|
||||
// Assert.IsNotNull(c1, type + "not found for mode=1");
|
||||
//
|
||||
// cu = Prepare(LanguageProperties.VBNet, 2);
|
||||
// IReturnType c2 = cu.ProjectContent.SearchType(new SearchTypeRequest(type, typeParameterCount, null, cu, 1, 1)).Result;
|
||||
// Assert.IsNotNull(c2, type + "not found for mode=2");
|
||||
//
|
||||
// Assert.IsTrue(c0.Equals(c1) && c0.Equals(c2));
|
||||
//
|
||||
// return c0;
|
||||
// }
|
||||
//
|
||||
// void CheckType(string shortName, string vbShortName, string fullType, int typeParameterCount)
|
||||
// {
|
||||
// IReturnType type = SearchType(shortName, typeParameterCount);
|
||||
// Assert.AreEqual(fullType, type.FullyQualifiedName);
|
||||
// Assert.AreEqual(typeParameterCount, type.TypeArgumentCount);
|
||||
// type = SearchTypeVB(vbShortName, typeParameterCount);
|
||||
// Assert.AreEqual(fullType, type.FullyQualifiedName);
|
||||
// Assert.AreEqual(typeParameterCount, type.TypeArgumentCount);
|
||||
// }
|
||||
// #endregion
|
||||
//
|
||||
// // EventHandler vs. EventHandler<TEventArgs>
|
||||
// // both mscorlib, both namespace System
|
||||
// [Test] public void FindEventHandler() {
|
||||
// CheckType("EventHandler", "EvEnThAndler", "System.EventHandler", 0);
|
||||
// }
|
||||
// [Test] public void FindGenericEventHandler() {
|
||||
// CheckType("EventHandler", "EvEnThAndler", "System.EventHandler", 1);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// [Test] public void FindNullableClass() {
|
||||
// CheckType("Nullable", "NuLLable", "System.Nullable", 0);
|
||||
// }
|
||||
// [Test] public void FindNullableStruct() {
|
||||
// CheckType("Nullable", "NuLLable", "System.Nullable", 1);
|
||||
// }
|
||||
//
|
||||
// // ICollection vs. ICollection<T>
|
||||
// // both mscorlib, different namespaces
|
||||
// [Test] public void FindCollection() {
|
||||
// CheckType("ICollection", "IColLEction", "System.Collections.ICollection", 0);
|
||||
// }
|
||||
// [Test] public void FindGenericCollection() {
|
||||
// CheckType("ICollection", "IColLEction", "System.Collections.Generic.ICollection", 1);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,302 +1,303 @@
@@ -1,302 +1,303 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Collections.ObjectModel; |
||||
using System.Xml.Linq; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.StringTagProvider |
||||
{ |
||||
/// <summary>
|
||||
/// Mock IProject implementation to test the SharpDevelopStringTagProvider.
|
||||
/// </summary>
|
||||
public class MockProjectForTagProvider : IProject |
||||
{ |
||||
string fileName = String.Empty; |
||||
string directory = String.Empty; |
||||
string outputAssemblyFullPath = String.Empty; |
||||
string name = String.Empty; |
||||
|
||||
public MockProjectForTagProvider() |
||||
{ |
||||
} |
||||
|
||||
public ReadOnlyCollection<ProjectItem> Items { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public ICollection<ItemType> AvailableFileItemTypes { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public List<ProjectSection> ProjectSections { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public LanguageProperties LanguageProperties { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string FileName { |
||||
get { return fileName; } |
||||
set { fileName = value; } |
||||
} |
||||
|
||||
public string Directory { |
||||
get { return directory; } |
||||
set { directory = value; } |
||||
} |
||||
|
||||
public bool ReadOnly { |
||||
get { return false; } |
||||
} |
||||
|
||||
public string AssemblyName { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string RootNamespace { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string OutputAssemblyFullPath { |
||||
get { return outputAssemblyFullPath; } |
||||
set { outputAssemblyFullPath = value; } |
||||
} |
||||
|
||||
public string Language { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string AppDesignerFolder { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string ActiveConfiguration { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string ActivePlatform { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public event EventHandler ActiveConfigurationChanged { add {} remove {} } |
||||
|
||||
public event EventHandler ActivePlatformChanged { add {} remove {} } |
||||
|
||||
public ICollection<string> ConfigurationNames { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public ICollection<string> PlatformNames { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsStartable { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public int MinimumSolutionVersion { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public object SyncRoot { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public ISolutionFolderContainer Parent { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public Solution ParentSolution { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string TypeGuid { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string IdGuid { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string Location { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string Name { |
||||
get { return name; } |
||||
set { name = value; } |
||||
} |
||||
|
||||
public IEnumerable<ProjectItem> GetItemsOfType(ItemType type) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public ItemType GetDefaultItemType(string fileName) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public ICSharpCode.SharpDevelop.Dom.IAmbience GetAmbience() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public void Save() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public bool IsFileInProject(string fileName) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public FileProjectItem FindFile(string fileName) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public void Start(bool withDebugging) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public ParseProjectContent CreateProjectContent() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public ProjectItem CreateProjectItem(IProjectItemBackendStore item) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public void ResolveAssemblyReferences() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public ICollection<IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public void StartBuild(ProjectBuildOptions buildOptions, IBuildFeedbackSink feedbackSink) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public ProjectBuildOptions CreateProjectBuildOptions(BuildOptions options, bool isRootBuildable) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public void Dispose() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public Properties CreateMemento() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public void SetMemento(ICSharpCode.Core.Properties memento) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public void ProjectCreationComplete() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public XElement LoadProjectExtensions(string name) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public void SaveProjectExtensions(string name, XElement element) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public Properties ProjectSpecificProperties { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Collections.ObjectModel;
|
||||
//using System.Xml.Linq;
|
||||
//
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.StringTagProvider
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Mock IProject implementation to test the SharpDevelopStringTagProvider.
|
||||
// /// </summary>
|
||||
// public class MockProjectForTagProvider : IProject
|
||||
// {
|
||||
// string fileName = String.Empty;
|
||||
// string directory = String.Empty;
|
||||
// string outputAssemblyFullPath = String.Empty;
|
||||
// string name = String.Empty;
|
||||
//
|
||||
// public MockProjectForTagProvider()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public ReadOnlyCollection<ProjectItem> Items {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public ICollection<ItemType> AvailableFileItemTypes {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public List<ProjectSection> ProjectSections {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public LanguageProperties LanguageProperties {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string FileName {
|
||||
// get { return fileName; }
|
||||
// set { fileName = value; }
|
||||
// }
|
||||
//
|
||||
// public string Directory {
|
||||
// get { return directory; }
|
||||
// set { directory = value; }
|
||||
// }
|
||||
//
|
||||
// public bool ReadOnly {
|
||||
// get { return false; }
|
||||
// }
|
||||
//
|
||||
// public string AssemblyName {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string RootNamespace {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string OutputAssemblyFullPath {
|
||||
// get { return outputAssemblyFullPath; }
|
||||
// set { outputAssemblyFullPath = value; }
|
||||
// }
|
||||
//
|
||||
// public string Language {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string AppDesignerFolder {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string ActiveConfiguration {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string ActivePlatform {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public event EventHandler ActiveConfigurationChanged { add {} remove {} }
|
||||
//
|
||||
// public event EventHandler ActivePlatformChanged { add {} remove {} }
|
||||
//
|
||||
// public ICollection<string> ConfigurationNames {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public ICollection<string> PlatformNames {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsStartable {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public int MinimumSolutionVersion {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public object SyncRoot {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public ISolutionFolderContainer Parent {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public Solution ParentSolution {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string TypeGuid {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string IdGuid {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string Location {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string Name {
|
||||
// get { return name; }
|
||||
// set { name = value; }
|
||||
// }
|
||||
//
|
||||
// public IEnumerable<ProjectItem> GetItemsOfType(ItemType type)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public ItemType GetDefaultItemType(string fileName)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public ICSharpCode.SharpDevelop.Dom.IAmbience GetAmbience()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public void Save()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public bool IsFileInProject(string fileName)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public FileProjectItem FindFile(string fileName)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public void Start(bool withDebugging)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public ParseProjectContent CreateProjectContent()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public ProjectItem CreateProjectItem(IProjectItemBackendStore item)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public void ResolveAssemblyReferences()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public ICollection<IBuildable> GetBuildDependencies(ProjectBuildOptions buildOptions)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public void StartBuild(ProjectBuildOptions buildOptions, IBuildFeedbackSink feedbackSink)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public ProjectBuildOptions CreateProjectBuildOptions(BuildOptions options, bool isRootBuildable)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public void Dispose()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public Properties CreateMemento()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public void SetMemento(ICSharpCode.Core.Properties memento)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public void ProjectCreationComplete()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public XElement LoadProjectExtensions(string name)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public void SaveProjectExtensions(string name, XElement element)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public Properties ProjectSpecificProperties {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,112 +1,113 @@
@@ -1,112 +1,113 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.IO; |
||||
using ICSharpCode.SharpDevelop.Commands; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.StringTagProvider |
||||
{ |
||||
/// <summary>
|
||||
/// Tests the SharpDevelopStringTagProvider when there is an active project.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class ProjectTagsTestFixture |
||||
{ |
||||
SharpDevelopStringTagProvider tagProvider; |
||||
MockProjectForTagProvider project; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
project = new MockProjectForTagProvider(); |
||||
project.FileName = @"C:\Projects\MyProject\MyProject.csproj"; |
||||
project.Directory = @"C:\Projects\MyProject"; |
||||
project.OutputAssemblyFullPath = @"C:\Projects\MyProject\bin\Debug\MyProject.exe"; |
||||
project.Name = "MyProject"; |
||||
|
||||
ProjectService.CurrentProject = project; |
||||
tagProvider = new SharpDevelopStringTagProvider(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Sanity check the mock project implementation.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void MockProjectFileName() |
||||
{ |
||||
Assert.AreEqual(@"C:\Projects\MyProject\MyProject.csproj", project.FileName); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Sanity check the mock project implementation.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void MockProjectDirectory() |
||||
{ |
||||
Assert.AreEqual(@"C:\Projects\MyProject", project.Directory); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Sanity check the mock project implementation.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void MockProjectOutputAssemblyFullPath() |
||||
{ |
||||
Assert.AreEqual(@"C:\Projects\MyProject\bin\Debug\MyProject.exe", project.OutputAssemblyFullPath); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Sanity check the mock project implementation.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void MockProjectName() |
||||
{ |
||||
Assert.AreEqual("MyProject", project.Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConvertCurrentProjectName() |
||||
{ |
||||
Assert.AreEqual(project.Name, tagProvider.ProvideString("CurrentProjectName")); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConvertTargetPath() |
||||
{ |
||||
Assert.AreEqual(project.OutputAssemblyFullPath, tagProvider.ProvideString("TargetPath")); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConvertTargetDir() |
||||
{ |
||||
Assert.AreEqual(Path.GetDirectoryName(project.OutputAssemblyFullPath), tagProvider.ProvideString("TargetDir")); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConvertTargetName() |
||||
{ |
||||
Assert.AreEqual("MyProject.exe", tagProvider.ProvideString("TargetName")); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConvertTargetExt() |
||||
{ |
||||
Assert.AreEqual(".exe", tagProvider.ProvideString("TargetExt")); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConvertProjectDir() |
||||
{ |
||||
Assert.AreEqual(project.Directory, tagProvider.ProvideString("ProjectDir")); |
||||
} |
||||
|
||||
[Test] |
||||
public void ConvertProjectFileName() |
||||
{ |
||||
Assert.AreEqual(Path.GetFileName(project.FileName), tagProvider.ProvideString("ProjectFileName")); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using ICSharpCode.SharpDevelop.Commands;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.StringTagProvider
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests the SharpDevelopStringTagProvider when there is an active project.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class ProjectTagsTestFixture
|
||||
// {
|
||||
// SharpDevelopStringTagProvider tagProvider;
|
||||
// MockProjectForTagProvider project;
|
||||
//
|
||||
// [SetUp]
|
||||
// public void Init()
|
||||
// {
|
||||
// project = new MockProjectForTagProvider();
|
||||
// project.FileName = @"C:\Projects\MyProject\MyProject.csproj";
|
||||
// project.Directory = @"C:\Projects\MyProject";
|
||||
// project.OutputAssemblyFullPath = @"C:\Projects\MyProject\bin\Debug\MyProject.exe";
|
||||
// project.Name = "MyProject";
|
||||
//
|
||||
// ProjectService.CurrentProject = project;
|
||||
// tagProvider = new SharpDevelopStringTagProvider();
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Sanity check the mock project implementation.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void MockProjectFileName()
|
||||
// {
|
||||
// Assert.AreEqual(@"C:\Projects\MyProject\MyProject.csproj", project.FileName);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Sanity check the mock project implementation.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void MockProjectDirectory()
|
||||
// {
|
||||
// Assert.AreEqual(@"C:\Projects\MyProject", project.Directory);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Sanity check the mock project implementation.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void MockProjectOutputAssemblyFullPath()
|
||||
// {
|
||||
// Assert.AreEqual(@"C:\Projects\MyProject\bin\Debug\MyProject.exe", project.OutputAssemblyFullPath);
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Sanity check the mock project implementation.
|
||||
// /// </summary>
|
||||
// [Test]
|
||||
// public void MockProjectName()
|
||||
// {
|
||||
// Assert.AreEqual("MyProject", project.Name);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConvertCurrentProjectName()
|
||||
// {
|
||||
// Assert.AreEqual(project.Name, tagProvider.ProvideString("CurrentProjectName"));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConvertTargetPath()
|
||||
// {
|
||||
// Assert.AreEqual(project.OutputAssemblyFullPath, tagProvider.ProvideString("TargetPath"));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConvertTargetDir()
|
||||
// {
|
||||
// Assert.AreEqual(Path.GetDirectoryName(project.OutputAssemblyFullPath), tagProvider.ProvideString("TargetDir"));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConvertTargetName()
|
||||
// {
|
||||
// Assert.AreEqual("MyProject.exe", tagProvider.ProvideString("TargetName"));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConvertTargetExt()
|
||||
// {
|
||||
// Assert.AreEqual(".exe", tagProvider.ProvideString("TargetExt"));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConvertProjectDir()
|
||||
// {
|
||||
// Assert.AreEqual(project.Directory, tagProvider.ProvideString("ProjectDir"));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ConvertProjectFileName()
|
||||
// {
|
||||
// Assert.AreEqual(Path.GetFileName(project.FileName), tagProvider.ProvideString("ProjectFileName"));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,83 +1,84 @@
@@ -1,83 +1,84 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.Utils |
||||
{ |
||||
/// <summary>
|
||||
/// Mock Ambience class.
|
||||
/// </summary>
|
||||
public class MockAmbience : AbstractAmbience |
||||
{ |
||||
public MockAmbience() |
||||
{ |
||||
} |
||||
|
||||
public override string Convert(IClass c) |
||||
{ |
||||
return String.Empty; |
||||
} |
||||
|
||||
public override string ConvertEnd(IClass c) |
||||
{ |
||||
return String.Empty; |
||||
} |
||||
|
||||
public override string Convert(IField c) |
||||
{ |
||||
return String.Empty; |
||||
} |
||||
|
||||
public override string Convert(IProperty property) |
||||
{ |
||||
return property.Name; |
||||
} |
||||
|
||||
public override string Convert(IEvent e) |
||||
{ |
||||
return String.Empty; |
||||
} |
||||
|
||||
public override string Convert(IMethod m) |
||||
{ |
||||
return m.Name; |
||||
} |
||||
|
||||
public override string ConvertEnd(IMethod m) |
||||
{ |
||||
return String.Empty; |
||||
} |
||||
|
||||
public override string Convert(IParameter param) |
||||
{ |
||||
return String.Empty; |
||||
} |
||||
|
||||
public override string Convert(IReturnType returnType) |
||||
{ |
||||
return String.Empty; |
||||
} |
||||
|
||||
public override string WrapAttribute(string attribute) |
||||
{ |
||||
return String.Empty; |
||||
} |
||||
|
||||
public override string WrapComment(string comment) |
||||
{ |
||||
return String.Empty; |
||||
} |
||||
|
||||
public override string GetIntrinsicTypeName(string dotNetTypeName) |
||||
{ |
||||
return String.Empty; |
||||
} |
||||
|
||||
public override string ConvertAccessibility(ModifierEnum accessibility) |
||||
{ |
||||
return String.Empty; |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.Utils
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Mock Ambience class.
|
||||
// /// </summary>
|
||||
// public class MockAmbience : AbstractAmbience
|
||||
// {
|
||||
// public MockAmbience()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public override string Convert(IClass c)
|
||||
// {
|
||||
// return String.Empty;
|
||||
// }
|
||||
//
|
||||
// public override string ConvertEnd(IClass c)
|
||||
// {
|
||||
// return String.Empty;
|
||||
// }
|
||||
//
|
||||
// public override string Convert(IField c)
|
||||
// {
|
||||
// return String.Empty;
|
||||
// }
|
||||
//
|
||||
// public override string Convert(IProperty property)
|
||||
// {
|
||||
// return property.Name;
|
||||
// }
|
||||
//
|
||||
// public override string Convert(IEvent e)
|
||||
// {
|
||||
// return String.Empty;
|
||||
// }
|
||||
//
|
||||
// public override string Convert(IMethod m)
|
||||
// {
|
||||
// return m.Name;
|
||||
// }
|
||||
//
|
||||
// public override string ConvertEnd(IMethod m)
|
||||
// {
|
||||
// return String.Empty;
|
||||
// }
|
||||
//
|
||||
// public override string Convert(IParameter param)
|
||||
// {
|
||||
// return String.Empty;
|
||||
// }
|
||||
//
|
||||
// public override string Convert(IReturnType returnType)
|
||||
// {
|
||||
// return String.Empty;
|
||||
// }
|
||||
//
|
||||
// public override string WrapAttribute(string attribute)
|
||||
// {
|
||||
// return String.Empty;
|
||||
// }
|
||||
//
|
||||
// public override string WrapComment(string comment)
|
||||
// {
|
||||
// return String.Empty;
|
||||
// }
|
||||
//
|
||||
// public override string GetIntrinsicTypeName(string dotNetTypeName)
|
||||
// {
|
||||
// return String.Empty;
|
||||
// }
|
||||
//
|
||||
// public override string ConvertAccessibility(ModifierEnum accessibility)
|
||||
// {
|
||||
// return String.Empty;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,366 +1,367 @@
@@ -1,366 +1,367 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.Utils |
||||
{ |
||||
/// <summary>
|
||||
/// Dummy class that implements the IClass interface. The
|
||||
/// only properties this mock class implements is DefaultReturnType and FullyQualifiedName.
|
||||
/// </summary>
|
||||
public class MockClass : IClass |
||||
{ |
||||
public MockClass(string qualifiedName) |
||||
{ |
||||
this.FullyQualifiedName = qualifiedName; |
||||
} |
||||
|
||||
public string FullyQualifiedName { get; set; } |
||||
public IReturnType DefaultReturnType { get; set;} |
||||
|
||||
public string DotNetName { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string Name { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string Namespace { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public ClassType ClassType { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IProjectContent ProjectContent { |
||||
get { |
||||
return DefaultProjectContent.DummyProjectContent; |
||||
} |
||||
} |
||||
|
||||
public ICompilationUnit CompilationUnit { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IUsingScope UsingScope { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public DomRegion Region { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public DomRegion BodyRegion { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<IReturnType> BaseTypes { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<IClass> InnerClasses { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<IField> Fields { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<IProperty> Properties { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<IMethod> Methods { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<IEvent> Events { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<ITypeParameter> TypeParameters { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IEnumerable<IClass> ClassInheritanceTree { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IEnumerable<IClass> ClassInheritanceTreeClassesOnly { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IClass BaseClass { |
||||
get { |
||||
return BaseType.GetUnderlyingClass(); |
||||
} |
||||
} |
||||
|
||||
public IReturnType BaseType { get; set; } |
||||
|
||||
public bool HasPublicOrInternalStaticMembers { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool HasExtensionMethods { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsPartial { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IClass DeclaringType { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public ModifierEnum Modifiers { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<IAttribute> Attributes { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string Documentation { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsAbstract { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsSealed { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsStatic { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsConst { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsVirtual { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsPublic { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsProtected { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsPrivate { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsInternal { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsReadonly { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsProtectedAndInternal { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsProtectedOrInternal { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsOverride { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsOverridable { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsNew { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsSynthetic { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public object UserData { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsFrozen { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IReturnType GetBaseType(int index) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public IClass GetCompoundClass() |
||||
{ |
||||
return this; |
||||
} |
||||
|
||||
public IClass GetInnermostClass(int caretLine, int caretColumn) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public List<IClass> GetAccessibleTypes(IClass callingClass) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public IMember SearchMember(string memberName, LanguageProperties language) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public bool IsTypeInInheritanceTree(IClass possibleBaseClass) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public bool IsAccessible(IClass callingClass, bool isClassInInheritanceTree) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public void Freeze() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public int CompareTo(object obj) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public bool HasCompoundClass { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IEnumerable<IMember> AllMembers { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public EntityType EntityType { |
||||
get { return EntityType.Class; } |
||||
} |
||||
|
||||
public bool AddDefaultConstructorIfRequired { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.Utils
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Dummy class that implements the IClass interface. The
|
||||
// /// only properties this mock class implements is DefaultReturnType and FullyQualifiedName.
|
||||
// /// </summary>
|
||||
// public class MockClass : IClass
|
||||
// {
|
||||
// public MockClass(string qualifiedName)
|
||||
// {
|
||||
// this.FullyQualifiedName = qualifiedName;
|
||||
// }
|
||||
//
|
||||
// public string FullyQualifiedName { get; set; }
|
||||
// public IReturnType DefaultReturnType { get; set;}
|
||||
//
|
||||
// public string DotNetName {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string Name {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string Namespace {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public ClassType ClassType {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IProjectContent ProjectContent {
|
||||
// get {
|
||||
// return DefaultProjectContent.DummyProjectContent;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public ICompilationUnit CompilationUnit {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IUsingScope UsingScope {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public DomRegion Region {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public DomRegion BodyRegion {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<IReturnType> BaseTypes {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<IClass> InnerClasses {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<IField> Fields {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<IProperty> Properties {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<IMethod> Methods {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<IEvent> Events {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<ITypeParameter> TypeParameters {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IEnumerable<IClass> ClassInheritanceTree {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IEnumerable<IClass> ClassInheritanceTreeClassesOnly {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IClass BaseClass {
|
||||
// get {
|
||||
// return BaseType.GetUnderlyingClass();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IReturnType BaseType { get; set; }
|
||||
//
|
||||
// public bool HasPublicOrInternalStaticMembers {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool HasExtensionMethods {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsPartial {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IClass DeclaringType {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public ModifierEnum Modifiers {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<IAttribute> Attributes {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string Documentation {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsAbstract {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsSealed {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsStatic {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsConst {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsVirtual {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsPublic {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsProtected {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsPrivate {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsInternal {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsReadonly {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsProtectedAndInternal {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsProtectedOrInternal {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsOverride {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsOverridable {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsNew {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsSynthetic {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public object UserData {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsFrozen {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IReturnType GetBaseType(int index)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public IClass GetCompoundClass()
|
||||
// {
|
||||
// return this;
|
||||
// }
|
||||
//
|
||||
// public IClass GetInnermostClass(int caretLine, int caretColumn)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public List<IClass> GetAccessibleTypes(IClass callingClass)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public IMember SearchMember(string memberName, LanguageProperties language)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public bool IsTypeInInheritanceTree(IClass possibleBaseClass)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public bool IsAccessible(IClass callingClass, bool isClassInInheritanceTree)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public void Freeze()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public int CompareTo(object obj)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public bool HasCompoundClass {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IEnumerable<IMember> AllMembers {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public EntityType EntityType {
|
||||
// get { return EntityType.Class; }
|
||||
// }
|
||||
//
|
||||
// public bool AddDefaultConstructorIfRequired {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,159 +1,160 @@
@@ -1,159 +1,160 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.Utils |
||||
{ |
||||
public class MockDefaultReturnType : IReturnType |
||||
{ |
||||
List<IMethod> methods = new List<IMethod>(); |
||||
List<IProperty> properties = new List<IProperty>(); |
||||
|
||||
public MockDefaultReturnType() |
||||
{ |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the method list directly. Only available in the
|
||||
/// mock default return type class.
|
||||
/// </summary>
|
||||
public List<IMethod> Methods { |
||||
get { |
||||
return methods; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the property list directly. Only available in the
|
||||
/// mock default return type class.
|
||||
/// </summary>
|
||||
public List<IProperty> Properties { |
||||
get { |
||||
return properties; |
||||
} |
||||
} |
||||
|
||||
public bool Equals(IReturnType other) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public string FullyQualifiedName { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string Name { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string Namespace { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string DotNetName { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public int TypeArgumentCount { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsDefaultReturnType { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IClass GetUnderlyingClass() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public List<IMethod> GetMethods() |
||||
{ |
||||
return methods; |
||||
} |
||||
|
||||
public List<IProperty> GetProperties() |
||||
{ |
||||
return properties; |
||||
} |
||||
|
||||
public List<IField> GetFields() |
||||
{ |
||||
return new List<IField>(); |
||||
} |
||||
|
||||
public List<IEvent> GetEvents() |
||||
{ |
||||
return new List<IEvent>(); |
||||
} |
||||
|
||||
public ArrayReturnType CastToArrayReturnType() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public GenericReturnType CastToGenericReturnType() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public ConstructedReturnType CastToConstructedReturnType() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public bool IsArrayReturnType { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsGenericReturnType { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsConstructedReturnType { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsDecoratingReturnType<T>() where T : DecoratingReturnType |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public T CastToDecoratingReturnType<T>() where T : DecoratingReturnType |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public Nullable<bool> IsReferenceType { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IReturnType GetDirectReturnType() |
||||
{ |
||||
return this; |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.Utils
|
||||
//{
|
||||
// public class MockDefaultReturnType : IReturnType
|
||||
// {
|
||||
// List<IMethod> methods = new List<IMethod>();
|
||||
// List<IProperty> properties = new List<IProperty>();
|
||||
//
|
||||
// public MockDefaultReturnType()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Gets the method list directly. Only available in the
|
||||
// /// mock default return type class.
|
||||
// /// </summary>
|
||||
// public List<IMethod> Methods {
|
||||
// get {
|
||||
// return methods;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Gets the property list directly. Only available in the
|
||||
// /// mock default return type class.
|
||||
// /// </summary>
|
||||
// public List<IProperty> Properties {
|
||||
// get {
|
||||
// return properties;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool Equals(IReturnType other)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public string FullyQualifiedName {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string Name {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string Namespace {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string DotNetName {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public int TypeArgumentCount {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsDefaultReturnType {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IClass GetUnderlyingClass()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public List<IMethod> GetMethods()
|
||||
// {
|
||||
// return methods;
|
||||
// }
|
||||
//
|
||||
// public List<IProperty> GetProperties()
|
||||
// {
|
||||
// return properties;
|
||||
// }
|
||||
//
|
||||
// public List<IField> GetFields()
|
||||
// {
|
||||
// return new List<IField>();
|
||||
// }
|
||||
//
|
||||
// public List<IEvent> GetEvents()
|
||||
// {
|
||||
// return new List<IEvent>();
|
||||
// }
|
||||
//
|
||||
// public ArrayReturnType CastToArrayReturnType()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public GenericReturnType CastToGenericReturnType()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public ConstructedReturnType CastToConstructedReturnType()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public bool IsArrayReturnType {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsGenericReturnType {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsConstructedReturnType {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsDecoratingReturnType<T>() where T : DecoratingReturnType
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public T CastToDecoratingReturnType<T>() where T : DecoratingReturnType
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public Nullable<bool> IsReferenceType {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IReturnType GetDirectReturnType()
|
||||
// {
|
||||
// return this;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,33 +1,34 @@
@@ -1,33 +1,34 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.Utils |
||||
{ |
||||
public class MockEntity : AbstractEntity |
||||
{ |
||||
public MockEntity() : base(null) |
||||
{ |
||||
} |
||||
|
||||
public override string DocumentationTag { |
||||
get { |
||||
return String.Empty; |
||||
} |
||||
} |
||||
|
||||
public override ICompilationUnit CompilationUnit { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public override EntityType EntityType { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.Utils
|
||||
//{
|
||||
// public class MockEntity : AbstractEntity
|
||||
// {
|
||||
// public MockEntity() : base(null)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public override string DocumentationTag {
|
||||
// get {
|
||||
// return String.Empty;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public override ICompilationUnit CompilationUnit {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public override EntityType EntityType {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,278 +1,279 @@
@@ -1,278 +1,279 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.Utils |
||||
{ |
||||
public class MockMethod : IMethod |
||||
{ |
||||
string name = String.Empty; |
||||
|
||||
public MockMethod(string name) |
||||
{ |
||||
this.name = name; |
||||
} |
||||
|
||||
public string Name { |
||||
get { |
||||
return name; |
||||
} |
||||
} |
||||
|
||||
public IClass DeclaringType { get; set; } |
||||
public bool IsConst { get; set; } |
||||
public bool IsPrivate { get; set; } |
||||
public bool IsOverridable { get; set; } |
||||
|
||||
public IList<ITypeParameter> TypeParameters { |
||||
get { |
||||
return new ITypeParameter[0]; |
||||
} |
||||
} |
||||
|
||||
public bool IsConstructor { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsOperator { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<string> HandlesClauses { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<IParameter> Parameters { |
||||
get { |
||||
return new IParameter[0]; |
||||
} |
||||
} |
||||
|
||||
public bool IsExtensionMethod { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string FullyQualifiedName { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IReturnType DeclaringTypeReference { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public DomRegion Region { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string Namespace { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string DotNetName { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IReturnType ReturnType { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public DomRegion BodyRegion { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<ExplicitInterfaceImplementation> InterfaceImplementations { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public ModifierEnum Modifiers { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<IAttribute> Attributes { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string Documentation { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsAbstract { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsSealed { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsStatic { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsVirtual { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsPublic { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsProtected { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsInternal { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsReadonly { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsProtectedAndInternal { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsProtectedOrInternal { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsOverride { |
||||
get { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
public bool IsFrozen { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public void Freeze() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public IMember GenericMember { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsNew { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsSynthetic { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public object UserData { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IMember CreateSpecializedMember() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public bool IsAccessible(IClass callingClass, bool isClassInInheritanceTree) |
||||
{ |
||||
return !IsPrivate; |
||||
} |
||||
|
||||
public int CompareTo(object obj) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public object Clone() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public ICompilationUnit CompilationUnit { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IProjectContent ProjectContent { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public EntityType EntityType { |
||||
get { return EntityType.Method; } |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.Utils
|
||||
//{
|
||||
// public class MockMethod : IMethod
|
||||
// {
|
||||
// string name = String.Empty;
|
||||
//
|
||||
// public MockMethod(string name)
|
||||
// {
|
||||
// this.name = name;
|
||||
// }
|
||||
//
|
||||
// public string Name {
|
||||
// get {
|
||||
// return name;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IClass DeclaringType { get; set; }
|
||||
// public bool IsConst { get; set; }
|
||||
// public bool IsPrivate { get; set; }
|
||||
// public bool IsOverridable { get; set; }
|
||||
//
|
||||
// public IList<ITypeParameter> TypeParameters {
|
||||
// get {
|
||||
// return new ITypeParameter[0];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsConstructor {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsOperator {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<string> HandlesClauses {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<IParameter> Parameters {
|
||||
// get {
|
||||
// return new IParameter[0];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsExtensionMethod {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string FullyQualifiedName {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IReturnType DeclaringTypeReference {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public DomRegion Region {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string Namespace {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string DotNetName {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IReturnType ReturnType {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public DomRegion BodyRegion {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<ExplicitInterfaceImplementation> InterfaceImplementations {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public ModifierEnum Modifiers {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<IAttribute> Attributes {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string Documentation {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsAbstract {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsSealed {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsStatic {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsVirtual {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsPublic {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsProtected {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsInternal {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsReadonly {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsProtectedAndInternal {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsProtectedOrInternal {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsOverride {
|
||||
// get {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsFrozen {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void Freeze()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public IMember GenericMember {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsNew {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsSynthetic {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public object UserData {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IMember CreateSpecializedMember()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public bool IsAccessible(IClass callingClass, bool isClassInInheritanceTree)
|
||||
// {
|
||||
// return !IsPrivate;
|
||||
// }
|
||||
//
|
||||
// public int CompareTo(object obj)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public object Clone()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public ICompilationUnit CompilationUnit {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IProjectContent ProjectContent {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public EntityType EntityType {
|
||||
// get { return EntityType.Method; }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,25 +1,26 @@
@@ -1,25 +1,26 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Dom.CSharp; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.Utils |
||||
{ |
||||
/// <summary>
|
||||
/// Mocks IProject class that returns a dummy ambience.
|
||||
/// </summary>
|
||||
public class MockProject : AbstractProject |
||||
{ |
||||
public MockProject() |
||||
{ |
||||
} |
||||
|
||||
public override IAmbience GetAmbience() |
||||
{ |
||||
return null; |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//using ICSharpCode.SharpDevelop.Dom.CSharp;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.Utils
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Mocks IProject class that returns a dummy ambience.
|
||||
// /// </summary>
|
||||
// public class MockProject : AbstractProject
|
||||
// {
|
||||
// public MockProject()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// public override IAmbience GetAmbience()
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,296 +1,297 @@
@@ -1,296 +1,297 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.Utils |
||||
{ |
||||
public class MockProperty : IProperty |
||||
{ |
||||
string name = String.Empty; |
||||
|
||||
public MockProperty(string name) |
||||
{ |
||||
this.name = name; |
||||
} |
||||
|
||||
public string Name { |
||||
get { |
||||
return name; |
||||
} |
||||
} |
||||
|
||||
public IClass DeclaringType { get; set; } |
||||
public bool IsConst { get; set; } |
||||
public bool IsPrivate { get; set;} |
||||
public bool IsOverridable { get; set;} |
||||
|
||||
public DomRegion GetterRegion { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public DomRegion SetterRegion { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool CanGet { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool CanSet { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsIndexer { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public ModifierEnum GetterModifiers { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public ModifierEnum SetterModifiers { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<IParameter> Parameters { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsExtensionMethod { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string FullyQualifiedName { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IReturnType DeclaringTypeReference { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IMember GenericMember { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public DomRegion Region { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string Namespace { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string DotNetName { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IReturnType ReturnType { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public DomRegion BodyRegion { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<ExplicitInterfaceImplementation> InterfaceImplementations { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public ModifierEnum Modifiers { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IList<IAttribute> Attributes { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public string Documentation { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsAbstract { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsSealed { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsStatic { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsVirtual { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsPublic { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsProtected { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsInternal { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsReadonly { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsProtectedAndInternal { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsProtectedOrInternal { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsOverride { |
||||
get { |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
public bool IsNew { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsSynthetic { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public object UserData { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
set { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public bool IsFrozen { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IMember CreateSpecializedMember() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public bool IsAccessible(IClass callingClass, bool isClassInInheritanceTree) |
||||
{ |
||||
return !IsPrivate; |
||||
} |
||||
|
||||
public void Freeze() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public int CompareTo(object obj) |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public object Clone() |
||||
{ |
||||
throw new NotImplementedException(); |
||||
} |
||||
|
||||
public ICompilationUnit CompilationUnit { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public IProjectContent ProjectContent { |
||||
get { |
||||
throw new NotImplementedException(); |
||||
} |
||||
} |
||||
|
||||
public EntityType EntityType { |
||||
get { return EntityType.Property; } |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using ICSharpCode.SharpDevelop.Dom;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.Utils
|
||||
//{
|
||||
// public class MockProperty : IProperty
|
||||
// {
|
||||
// string name = String.Empty;
|
||||
//
|
||||
// public MockProperty(string name)
|
||||
// {
|
||||
// this.name = name;
|
||||
// }
|
||||
//
|
||||
// public string Name {
|
||||
// get {
|
||||
// return name;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IClass DeclaringType { get; set; }
|
||||
// public bool IsConst { get; set; }
|
||||
// public bool IsPrivate { get; set;}
|
||||
// public bool IsOverridable { get; set;}
|
||||
//
|
||||
// public DomRegion GetterRegion {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public DomRegion SetterRegion {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool CanGet {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool CanSet {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsIndexer {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public ModifierEnum GetterModifiers {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public ModifierEnum SetterModifiers {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<IParameter> Parameters {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsExtensionMethod {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string FullyQualifiedName {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IReturnType DeclaringTypeReference {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IMember GenericMember {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public DomRegion Region {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string Namespace {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string DotNetName {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IReturnType ReturnType {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public DomRegion BodyRegion {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<ExplicitInterfaceImplementation> InterfaceImplementations {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public ModifierEnum Modifiers {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IList<IAttribute> Attributes {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public string Documentation {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsAbstract {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsSealed {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsStatic {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsVirtual {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsPublic {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsProtected {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsInternal {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsReadonly {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsProtectedAndInternal {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsProtectedOrInternal {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsOverride {
|
||||
// get {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsNew {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsSynthetic {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public object UserData {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// set {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public bool IsFrozen {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IMember CreateSpecializedMember()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public bool IsAccessible(IClass callingClass, bool isClassInInheritanceTree)
|
||||
// {
|
||||
// return !IsPrivate;
|
||||
// }
|
||||
//
|
||||
// public void Freeze()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public int CompareTo(object obj)
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public object Clone()
|
||||
// {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
//
|
||||
// public ICompilationUnit CompilationUnit {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public IProjectContent ProjectContent {
|
||||
// get {
|
||||
// throw new NotImplementedException();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public EntityType EntityType {
|
||||
// get { return EntityType.Property; }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,59 +1,60 @@
@@ -1,59 +1,60 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.ComponentModel.Design; |
||||
|
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Editor.AvalonEdit; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.Utils |
||||
{ |
||||
/// <summary>
|
||||
/// Description of MockTextEditor.
|
||||
/// </summary>
|
||||
public class MockTextMarkerService : ITextMarkerService |
||||
{ |
||||
public static IDocument CreateDocumentWithMockService() |
||||
{ |
||||
ServiceContainer container = new ServiceContainer(); |
||||
container.AddService(typeof(ITextMarkerService), new MockTextMarkerService()); |
||||
|
||||
return new AvalonEditDocumentAdapter(new ICSharpCode.AvalonEdit.Document.TextDocument(), container); |
||||
} |
||||
|
||||
List<ITextMarker> markers; |
||||
|
||||
public MockTextMarkerService() |
||||
{ |
||||
this.markers = new List<ITextMarker>(); |
||||
} |
||||
|
||||
public System.Collections.Generic.IEnumerable<ITextMarker> TextMarkers { |
||||
get { |
||||
return this.markers; |
||||
} |
||||
} |
||||
|
||||
public ITextMarker Create(int startOffset, int length) |
||||
{ |
||||
ITextMarker m = new MockTextMarker(this.markers, startOffset, startOffset + length, length); |
||||
this.markers.Add(m); |
||||
return m; |
||||
} |
||||
|
||||
public void Remove(ITextMarker marker) |
||||
{ |
||||
marker.Delete(); |
||||
} |
||||
|
||||
public void RemoveAll(Predicate<ITextMarker> predicate) |
||||
{ |
||||
foreach (ITextMarker m in markers.ToArray()) { |
||||
if (predicate(m)) |
||||
m.Delete(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.ComponentModel.Design;
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop.Editor;
|
||||
//using ICSharpCode.SharpDevelop.Editor.AvalonEdit;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.Utils
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Description of MockTextEditor.
|
||||
// /// </summary>
|
||||
// public class MockTextMarkerService : ITextMarkerService
|
||||
// {
|
||||
// public static IDocument CreateDocumentWithMockService()
|
||||
// {
|
||||
// ServiceContainer container = new ServiceContainer();
|
||||
// container.AddService(typeof(ITextMarkerService), new MockTextMarkerService());
|
||||
//
|
||||
// return new AvalonEditDocumentAdapter(new ICSharpCode.AvalonEdit.Document.TextDocument(), container);
|
||||
// }
|
||||
//
|
||||
// List<ITextMarker> markers;
|
||||
//
|
||||
// public MockTextMarkerService()
|
||||
// {
|
||||
// this.markers = new List<ITextMarker>();
|
||||
// }
|
||||
//
|
||||
// public System.Collections.Generic.IEnumerable<ITextMarker> TextMarkers {
|
||||
// get {
|
||||
// return this.markers;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public ITextMarker Create(int startOffset, int length)
|
||||
// {
|
||||
// ITextMarker m = new MockTextMarker(this.markers, startOffset, startOffset + length, length);
|
||||
// this.markers.Add(m);
|
||||
// return m;
|
||||
// }
|
||||
//
|
||||
// public void Remove(ITextMarker marker)
|
||||
// {
|
||||
// marker.Delete();
|
||||
// }
|
||||
//
|
||||
// public void RemoveAll(Predicate<ITextMarker> predicate)
|
||||
// {
|
||||
// foreach (ITextMarker m in markers.ToArray()) {
|
||||
// if (predicate(m))
|
||||
// m.Delete();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,733 +0,0 @@
@@ -1,733 +0,0 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Reflection; |
||||
using System.Collections.Generic; |
||||
using NUnit.Framework; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Dom.VBNet; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests |
||||
{ |
||||
[TestFixture] |
||||
public class VBExpressionFinderTests |
||||
{ |
||||
const string program1 = @"
|
||||
Imports System |
||||
Imports System.Linq |
||||
|
||||
Class MainClass ' a comment |
||||
Dim under_score_field As Integer |
||||
Sub SomeMethod() |
||||
simple += 1 |
||||
Dim text = ""Text"" |
||||
For Each loopVarName In collection |
||||
Next |
||||
End Sub |
||||
End Class |
||||
";
|
||||
|
||||
VBNetExpressionFinder ef; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
HostCallback.GetCurrentProjectContent = delegate { |
||||
return ParserService.CurrentProjectContent; |
||||
}; |
||||
|
||||
ef = new VBNetExpressionFinder(null); |
||||
} |
||||
|
||||
void FindFull(string program, string expectedExpression, ExpressionContext expectedContext) |
||||
{ |
||||
int pos = program.IndexOf("|"); |
||||
if (pos < 0) Assert.Fail("location not found in program"); |
||||
program = program.Remove(pos, 1); |
||||
ExpressionResult er = ef.FindFullExpression(program, pos); |
||||
Assert.AreEqual(expectedExpression, er.Expression); |
||||
Assert.AreEqual(expectedContext.ToString(), er.Context.ToString()); |
||||
} |
||||
|
||||
void Find(string program, string expectedExpression, ExpressionContext expectedContext) |
||||
{ |
||||
int pos = program.IndexOf("|"); |
||||
if (pos < 0) Assert.Fail("location not found in program"); |
||||
program = program.Remove(pos, 1); |
||||
ExpressionResult er = ef.FindExpression(program, pos); |
||||
Assert.AreEqual(expectedExpression, er.Expression); |
||||
Assert.AreEqual(expectedContext.ToString(), er.Context.ToString()); |
||||
} |
||||
|
||||
#region Find
|
||||
[Test] |
||||
public void FindSimple() |
||||
{ |
||||
string program2 = @"
|
||||
Class MainClass |
||||
Sub A |
||||
Con|sole.WriteLine(""Hello World!"") |
||||
End Sub |
||||
End Class |
||||
";
|
||||
|
||||
Find(program2, "Con", ExpressionContext.MethodBody); |
||||
} |
||||
|
||||
[Test] |
||||
public void FindSimple2() |
||||
{ |
||||
string program2 = @"
|
||||
Class MainClass |
||||
Sub A |
||||
Console.|WriteLine(""Hello World!"") |
||||
End Sub |
||||
End Class |
||||
";
|
||||
|
||||
Find(program2, "Console.", ExpressionContext.Default); |
||||
} |
||||
|
||||
[Test] |
||||
public void FindSimple3() |
||||
{ |
||||
string program3 = @"
|
||||
Class MainClass |
||||
Sub A |
||||
Console.WriteLine| |
||||
End Sub |
||||
End Class |
||||
";
|
||||
|
||||
Find(program3, "Console.WriteLine", ExpressionContext.Default); |
||||
} |
||||
|
||||
[Test] |
||||
public void FindAfterBrace() |
||||
{ |
||||
string program2 = @"
|
||||
Class MainClass |
||||
Sub A |
||||
Console.WriteLine(|""Hello World!"") |
||||
End Sub |
||||
End Class |
||||
";
|
||||
|
||||
Find(program2, "", ExpressionContext.Default); |
||||
} |
||||
|
||||
[Test] |
||||
public void ForEachLoop() |
||||
{ |
||||
string program1 = @"
|
||||
Imports System |
||||
Imports System.Linq |
||||
|
||||
Class MainClass ' a comment |
||||
Dim under_score_field As Integer |
||||
Sub SomeMethod() |
||||
simple += 1 |
||||
Dim text = ""Text"" |
||||
For Each loop|VarName In collection |
||||
Next |
||||
End Sub |
||||
End Class |
||||
";
|
||||
|
||||
Find(program1, "loop", ExpressionContext.IdentifierExpected); |
||||
} |
||||
|
||||
[Test] |
||||
public void FindEmptyAfterImports() |
||||
{ |
||||
string program1 = @"
|
||||
Imports System |
||||
Imports System.Linq |
||||
| |
||||
Class MainClass ' a comment |
||||
Dim under_score_field As Integer |
||||
Sub SomeMethod() |
||||
simple += 1 |
||||
Dim text = ""Text"" |
||||
For Each loopVarName In collection |
||||
Next |
||||
End Sub |
||||
End Class |
||||
";
|
||||
Find(program1, "", ExpressionContext.Global); |
||||
} |
||||
|
||||
[Test] |
||||
public void FindParameterStart() |
||||
{ |
||||
Find(@"Module Program
|
||||
Private Function CreateFolder(| |
||||
End Module", "", ExpressionContext.IdentifierExpected);
|
||||
} |
||||
|
||||
[Test] |
||||
public void FindAfterNewLineImport() |
||||
{ |
||||
Find("Imports System\n|", "", ExpressionContext.Global); |
||||
} |
||||
|
||||
[Test] |
||||
public void FindInArgumentList() |
||||
{ |
||||
Find(@"Class MainClass
|
||||
Sub Main() |
||||
Test(Te|st2(1) + Test2(2)) |
||||
End Sub |
||||
End Class", "Te", ExpressionContext.Default);
|
||||
} |
||||
|
||||
[Test] |
||||
public void FindExpressionBeforeBrace() |
||||
{ |
||||
Find(@"Class MainClass
|
||||
Sub Main() |
||||
Test(Test2|(1) + Test2(2)) |
||||
End Sub |
||||
End Class", "Test2", ExpressionContext.Default);
|
||||
} |
||||
|
||||
[Test] |
||||
public void FindExpressionAfterThen() |
||||
{ |
||||
Find(@"Class MainClass
|
||||
Sub Main() |
||||
If True Then Double| |
||||
End Sub |
||||
End Class", "Double", ExpressionContext.MethodBody);
|
||||
} |
||||
|
||||
[Test] |
||||
public void FindExpressionAfterWordBegin() |
||||
{ |
||||
Find(@"Class MainClass
|
||||
Dim test As Integer |
||||
Sub Main() |
||||
If Me.test i| Then |
||||
|
||||
End If |
||||
End Sub |
||||
End Class", "i", ExpressionContext.Default);
|
||||
} |
||||
#endregion
|
||||
|
||||
#region Context Tests
|
||||
void ContextTest(string program, ExpressionContext context) |
||||
{ |
||||
int pos = program.IndexOf("|"); |
||||
if (pos < 0) Assert.Fail("location not found in program"); |
||||
program = program.Remove(pos, 1); |
||||
ExpressionResult er = ef.FindExpression(program, pos); |
||||
Assert.AreEqual(context.ToString(), er.Context.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void ContextAfterDimIdentifierSpace() |
||||
{ |
||||
string program4 = @"
|
||||
Class MainClass |
||||
Sub A |
||||
Dim a | |
||||
End Sub |
||||
End Class |
||||
";
|
||||
|
||||
ContextTest(program4, ExpressionContext.MethodBody); |
||||
} |
||||
|
||||
[Test] |
||||
public void ContextAfterDimIdentifierAs() |
||||
{ |
||||
string prg = @"Module Test
|
||||
Sub Test() |
||||
Dim x As | |
||||
End Sub |
||||
End Module";
|
||||
ContextTest(prg, ExpressionContext.Type); |
||||
} |
||||
|
||||
[Test] |
||||
public void ContextAfterDim() |
||||
{ |
||||
string program4 = @"
|
||||
Class MainClass |
||||
Sub A |
||||
Dim | |
||||
End Sub |
||||
End Class |
||||
";
|
||||
ContextTest(program4, ExpressionContext.IdentifierExpected); |
||||
} |
||||
|
||||
[Test] |
||||
public void ContextInModule() |
||||
{ |
||||
string prg = @"Module Test
|
||||
| |
||||
End Module";
|
||||
|
||||
ContextTest(prg, ExpressionContext.TypeDeclaration); |
||||
} |
||||
#endregion
|
||||
|
||||
#region FindFull
|
||||
[Test] |
||||
public void Simple() |
||||
{ |
||||
string program1 = @"
|
||||
Imports System |
||||
Imports System.Linq |
||||
|
||||
Class MainClass ' a comment |
||||
Dim under_score_field As Integer |
||||
Sub SomeMethod() |
||||
si|mple += 1 |
||||
Dim text = ""Text"" |
||||
For Each loopVarName In collection |
||||
Next |
||||
End Sub |
||||
End Class |
||||
";
|
||||
FindFull(program1, "simple", ExpressionContext.Default); |
||||
} |
||||
|
||||
[Test] |
||||
public void SimpleBeginningOfExpression() |
||||
{ |
||||
string program1 = @"
|
||||
Imports System |
||||
Imports System.Linq |
||||
|
||||
Class MainClass ' a comment |
||||
Dim under_score_field As Integer |
||||
Sub SomeMethod() |
||||
|simple += 1 |
||||
Dim text = ""Text"" |
||||
For Each loopVarName In collection |
||||
Next |
||||
End Sub |
||||
End Class |
||||
";
|
||||
FindFull(program1, "simple", ExpressionContext.Default); |
||||
} |
||||
|
||||
[Test] |
||||
public void Underscore() |
||||
{ |
||||
string program1 = @"
|
||||
Imports System |
||||
Imports System.Linq |
||||
|
||||
Class MainClass ' a comment |
||||
Dim un|der_score_field As Integer |
||||
Sub SomeMethod() |
||||
simple += 1 |
||||
Dim text = ""Text"" |
||||
For Each loopVarName In collection |
||||
Next |
||||
End Sub |
||||
End Class |
||||
";
|
||||
|
||||
FindFull(program1, "under_score_field", ExpressionContext.Default); |
||||
} |
||||
|
||||
[Test] |
||||
public void IdentifierBeforeKeyword() |
||||
{ |
||||
string program1 = @"
|
||||
Imports System |
||||
Imports System.Linq |
||||
|
||||
Class MainClass ' a comment |
||||
Dim under_score_field As Integer |
||||
Sub SomeMethod() |
||||
simple += 1 |
||||
Dim text = ""Text"" |
||||
For Each loopV|arName In collection |
||||
Next |
||||
End Sub |
||||
End Class |
||||
";
|
||||
|
||||
FindFull(program1, "loopVarName", ExpressionContext.Default); |
||||
} |
||||
|
||||
[Test] |
||||
public void LocalVariableDecl() |
||||
{ |
||||
string program1 = @"
|
||||
Imports System |
||||
Imports System.Linq |
||||
|
||||
Class MainClass ' a comment |
||||
Dim under_score_field As Integer |
||||
Sub SomeMethod() |
||||
simple += 1 |
||||
Dim t|ext = ""Text"" |
||||
For Each loopVarName In collection |
||||
Next |
||||
End Sub |
||||
End Class |
||||
";
|
||||
|
||||
FindFull(program1, "text", ExpressionContext.Default); |
||||
} |
||||
|
||||
[Test] |
||||
public void Imports1() |
||||
{ |
||||
string program1 = @"
|
||||
Imports S|ystem |
||||
Imports System.Linq |
||||
|
||||
Class MainClass ' a comment |
||||
Dim under_score_field As Integer |
||||
Sub SomeMethod() |
||||
simple += 1 |
||||
Dim text = ""Text"" |
||||
For Each loopVarName In collection |
||||
Next |
||||
End Sub |
||||
End Class |
||||
";
|
||||
|
||||
FindFull(program1, "System", ExpressionContext.Importable); |
||||
} |
||||
|
||||
[Test] |
||||
public void Imports2() |
||||
{ |
||||
string program1 = @"
|
||||
Imports System |
||||
Imports System.L|inq |
||||
|
||||
Class MainClass ' a comment |
||||
Dim under_score_field As Integer |
||||
Sub SomeMethod() |
||||
simple += 1 |
||||
Dim text = ""Text"" |
||||
For Each loopVarName In collection |
||||
Next |
||||
End Sub |
||||
End Class |
||||
";
|
||||
FindFull(program1, "System.Linq", ExpressionContext.Importable); |
||||
} |
||||
|
||||
[Test] |
||||
public void ClassName() |
||||
{ |
||||
string program1 = @"
|
||||
Imports System |
||||
Imports System.Linq |
||||
|
||||
Class M|ainClass ' a comment |
||||
Dim under_score_field As Integer |
||||
Sub SomeMethod() |
||||
simple += 1 |
||||
Dim text = ""Text"" |
||||
For Each loopVarName In collection |
||||
Next |
||||
End Sub |
||||
End Class |
||||
";
|
||||
|
||||
FindFull(program1, "MainClass", ExpressionContext.Default); |
||||
} |
||||
|
||||
[Test] |
||||
public void SubName() |
||||
{ |
||||
string program1 = @"
|
||||
Imports System |
||||
Imports System.Linq |
||||
|
||||
Class MainClass ' a comment |
||||
Dim under_score_field As Integer |
||||
Sub S|omeMethod() |
||||
simple += 1 |
||||
Dim text = ""Text"" |
||||
For Each loopVarName In collection |
||||
Next |
||||
End Sub |
||||
End Class |
||||
";
|
||||
|
||||
FindFull(program1, "SomeMethod", ExpressionContext.Default); |
||||
} |
||||
|
||||
[Test] |
||||
public void ParameterName() |
||||
{ |
||||
FindFull(@"Module Test
|
||||
Function Fibo(|x As Integer) As Integer |
||||
|
||||
End Function |
||||
End Module", "x", ExpressionContext.Default);
|
||||
} |
||||
|
||||
[Test] |
||||
public void TypeKeywordMember() |
||||
{ |
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
String.For|mat(""{0}"", ""Test"") |
||||
End Sub |
||||
End Module", "String.Format(\"{0}\", \"Test\")", ExpressionContext.Default); |
||||
} |
||||
|
||||
[Test] |
||||
public void SimpleXml() |
||||
{ |
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim xml = <!-- te|st --> |
||||
|
||||
Dim x = 5 |
||||
End Sub |
||||
End Module", "<!-- test -->", ExpressionContext.Default);
|
||||
} |
||||
|
||||
[Test] |
||||
public void SimpleXml2() |
||||
{ |
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim xml = <!-- test --> |
||||
|
||||
Dim xml2 = <![CDATA[some| text]]> |
||||
End Sub |
||||
End Module", "<![CDATA[some text]]>", ExpressionContext.Default);
|
||||
} |
||||
|
||||
[Test] |
||||
public void SimpleXml3() |
||||
{ |
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim xml = <!-- test --> |
||||
|
||||
Dim x = |5 |
||||
End Sub |
||||
End Module", "5", ExpressionContext.Default);
|
||||
} |
||||
|
||||
[Test] |
||||
public void Linq1() |
||||
{ |
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim x = From kv|p As KeyValuePair(Of String, DataGridViewCellStyle) _ |
||||
In styleCache.CellStyleCache _ |
||||
Select includeStyle(kvp.Key, kvp.Value) |
||||
End Sub |
||||
End Module", "kvp", ExpressionContext.Default);
|
||||
|
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim x = From kvp As KeyValueP|air(Of String, DataGridViewCellStyle) _ |
||||
In styleCache.CellStyleCache _ |
||||
Select includeStyle(kvp.Key, kvp.Value) |
||||
End Sub |
||||
End Module", "KeyValuePair(Of String, DataGridViewCellStyle)", ExpressionContext.Type);
|
||||
|
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim x = From kvp As KeyValuePair(Of String, DataGridViewCellStyle) _ |
||||
In styleCac|he.CellStyleCache _ |
||||
Select includeStyle(kvp.Key, kvp.Value) |
||||
End Sub |
||||
End Module", "styleCache", ExpressionContext.Default);
|
||||
|
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim x = From kvp As KeyValuePair(Of String, DataGridViewCellStyle) _ |
||||
In styleCache.CellSty|leCache _ |
||||
Select includeStyle(kvp.Key, kvp.Value) |
||||
End Sub |
||||
End Module", "styleCache.CellStyleCache", ExpressionContext.Default);
|
||||
|
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim x = From kvp As KeyValuePair(Of String, DataGridViewCellStyle) _ |
||||
In styleCache.CellStyleCache _ |
||||
Select includ|eStyle(kvp.Key, kvp.Value) |
||||
End Sub |
||||
End Module", "includeStyle(kvp.Key, kvp.Value)", ExpressionContext.Default);
|
||||
|
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim x = From kvp As KeyValuePair(Of String, DataGridViewCellStyle) _ |
||||
In styleCache.CellStyleCache _ |
||||
Select includeStyle(kv|p.Key, kvp.Value) |
||||
End Sub |
||||
End Module", "kvp", ExpressionContext.Default);
|
||||
|
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim x = From kvp As KeyValuePair(Of String, DataGridViewCellStyle) _ |
||||
In styleCache.CellStyleCache _ |
||||
Select includeStyle(kvp.Key, kvp.Val|ue) |
||||
End Sub |
||||
End Module", "kvp.Value", ExpressionContext.Default);
|
||||
} |
||||
|
||||
[Test] |
||||
public void Linq2() |
||||
{ |
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim x = From kvp As KeyValuePair(Of String, DataGridViewCellStyle) _ |
||||
In styleCache.CellStyleCache _ |
||||
Select da|ta As DataGridViewCellStyle = includeStyle(kvp.Key, kvp.Value) |
||||
End Sub |
||||
End Module", "data", ExpressionContext.Default);
|
||||
|
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim x = From kvp As KeyValuePair(Of String, DataGridViewCellStyle) _ |
||||
In styleCache.CellStyleCache _ |
||||
Select data As DataG|ridViewCellStyle = includeStyle(kvp.Key, kvp.Value) |
||||
End Sub |
||||
End Module", "DataGridViewCellStyle", ExpressionContext.Type);
|
||||
} |
||||
|
||||
[Test] |
||||
public void Using1() |
||||
{ |
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Using |x As FileReader = New FileReader() |
||||
|
||||
End Using |
||||
End Sub |
||||
End Module", "x", ExpressionContext.Default);
|
||||
|
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Using x As FileR|eader = New FileReader() |
||||
|
||||
End Using |
||||
End Sub |
||||
End Module", "FileReader", ExpressionContext.Type);
|
||||
|
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Using x As New FileR|eader() |
||||
|
||||
End Using |
||||
End Sub |
||||
End Module", "FileReader()", ExpressionContext.ObjectCreation);
|
||||
|
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Using FileRea|der() |
||||
|
||||
End Using |
||||
End Sub |
||||
End Module", "FileReader()", ExpressionContext.Default);
|
||||
} |
||||
|
||||
[Test] |
||||
public void FunctionLambda() |
||||
{ |
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim f = Fun|ction(x, y) x + y |
||||
End Sub |
||||
End Module", "Function(x, y) x + y", ExpressionContext.Default);
|
||||
} |
||||
|
||||
[Test] |
||||
public void SubLambda() |
||||
{ |
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim f = Su|b(x, y) Console.WriteLine(x + y) |
||||
End Sub |
||||
End Module", "Sub(x, y) Console.WriteLine(x + y)", ExpressionContext.Default);
|
||||
} |
||||
|
||||
[Test] |
||||
public void NewExpression() |
||||
{ |
||||
FindFull(@"Module Test
|
||||
Sub Main() |
||||
Dim list = N|ew List(Of Integer) |
||||
End Sub |
||||
End Module", "New List(Of Integer)", ExpressionContext.Default);
|
||||
} |
||||
|
||||
#region Old Tests
|
||||
void OldTest(string expr, int offset) |
||||
{ |
||||
string body = @"Class Test
|
||||
Sub A |
||||
{0}.AnotherField |
||||
End Sub |
||||
End Class";
|
||||
Assert.AreEqual(expr, ef.FindFullExpression(string.Format(body, expr), @"Class Test
|
||||
Sub A |
||||
".Length + offset).Expression);
|
||||
} |
||||
|
||||
void OldTestFind(string expr, string expected, int offset) |
||||
{ |
||||
string body = @"Class Test
|
||||
Sub A |
||||
Dim x = abc + {0} |
||||
End Sub |
||||
End Class";
|
||||
Assert.AreEqual(expected, ef.FindExpression(string.Format(body, expr), @"Class Test
|
||||
Sub A |
||||
Dim x = abc + ".Length + offset).Expression);
|
||||
} |
||||
|
||||
[Test] |
||||
public void FieldReference() |
||||
{ |
||||
OldTest("abc", 1); |
||||
OldTest("abc.def", 6); |
||||
} |
||||
|
||||
[Test] |
||||
public void WithFieldReference() |
||||
{ |
||||
OldTest(".abc", 2); |
||||
OldTest(".abc.def", 7); |
||||
} |
||||
|
||||
[Test] |
||||
public void MethodCall() |
||||
{ |
||||
OldTest("abc.Method().Method()", 16); |
||||
} |
||||
|
||||
[Test] |
||||
public void ComplexMethodCall() |
||||
{ |
||||
OldTest("abc.Method().Method(5, a.b, 5 + a)", 16); |
||||
} |
||||
|
||||
[Test] |
||||
public void PlusExpression() |
||||
{ |
||||
OldTestFind("def", "de", 2); |
||||
} |
||||
|
||||
[Test] |
||||
public void PlusExpression2() |
||||
{ |
||||
OldTestFind("def", "", 0); |
||||
} |
||||
#endregion
|
||||
#endregion
|
||||
} |
||||
} |
||||
@ -1,163 +1,164 @@
@@ -1,163 +1,164 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.IO; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
[TestFixture] |
||||
public class DirectoryNodeFactoryTests |
||||
{ |
||||
DirectoryNode appDesignerFolderNode; |
||||
DirectoryNode ordinaryFolderNode; |
||||
DirectoryNode webReferencesFolderNode; |
||||
DirectoryNode missingWebReferencesFolderNode; |
||||
DirectoryNode missingOrdinaryFolderNode; |
||||
DirectoryNode webReferenceNode; |
||||
|
||||
string projectDirectory = "c:\\projects\\test"; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
project.FileName = Path.Combine(projectDirectory, "foo.csproj"); |
||||
project.AppDesignerFolder = "Properties"; |
||||
|
||||
WebReferencesProjectItem webReferencesItem = new WebReferencesProjectItem(project); |
||||
webReferencesItem.Include = "Web References\\"; |
||||
ProjectService.AddProjectItem(project, webReferencesItem); |
||||
|
||||
FileProjectItem fileItem = new FileProjectItem(project, ItemType.Folder); |
||||
fileItem.Include = "MissingFolder\\"; |
||||
ProjectService.AddProjectItem(project, fileItem); |
||||
|
||||
ProjectNode projectNode = new ProjectNode(project); |
||||
|
||||
appDesignerFolderNode = DirectoryNodeFactory.CreateDirectoryNode(projectNode, project, Path.Combine(projectDirectory, "Properties")); |
||||
ordinaryFolderNode = DirectoryNodeFactory.CreateDirectoryNode(projectNode, project, Path.Combine(project.Directory, "Test")); |
||||
webReferencesFolderNode = DirectoryNodeFactory.CreateDirectoryNode(projectNode, project, Path.Combine(project.Directory, webReferencesItem.Include)); |
||||
webReferenceNode = DirectoryNodeFactory.CreateDirectoryNode(webReferencesFolderNode, project, Path.Combine(Path.Combine(project.Directory, webReferencesItem.Include), "localhost")); |
||||
|
||||
missingWebReferencesFolderNode = DirectoryNodeFactory.CreateDirectoryNode(webReferencesItem, FileNodeStatus.Missing); |
||||
missingOrdinaryFolderNode = DirectoryNodeFactory.CreateDirectoryNode(fileItem, FileNodeStatus.Missing); |
||||
} |
||||
|
||||
[Test] |
||||
public void AppDesignerFolderNodeIsSpecialAppDesignerFolder() |
||||
{ |
||||
Assert.AreEqual(SpecialFolder.AppDesigner, appDesignerFolderNode.SpecialFolder); |
||||
} |
||||
|
||||
[Test] |
||||
public void AppDesignerFolderNodeDirectory() |
||||
{ |
||||
Assert.AreEqual(Path.Combine(projectDirectory, "Properties"), appDesignerFolderNode.Directory); |
||||
} |
||||
|
||||
[Test] |
||||
public void OrdinaryFolderNodeIsNotSpecialFolder() |
||||
{ |
||||
Assert.AreEqual(SpecialFolder.None, ordinaryFolderNode.SpecialFolder); |
||||
} |
||||
|
||||
[Test] |
||||
public void OrdinaryFolderNodeDirectory() |
||||
{ |
||||
Assert.AreEqual(Path.Combine(projectDirectory, "Test"), ordinaryFolderNode.Directory); |
||||
} |
||||
|
||||
[Test] |
||||
public void OrdinaryFolderNodeType() |
||||
{ |
||||
Assert.IsTrue(ordinaryFolderNode is DirectoryNode); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferencesFolderNodeIsSpecialWebReferencesFolder() |
||||
{ |
||||
Assert.AreEqual(SpecialFolder.WebReferencesFolder, webReferencesFolderNode.SpecialFolder); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferencesFolderNodeType() |
||||
{ |
||||
Assert.IsTrue(webReferencesFolderNode is WebReferencesFolderNode); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferencesFolderNodeDirectory() |
||||
{ |
||||
Assert.AreEqual(Path.Combine(projectDirectory, "Web References\\"), webReferencesFolderNode.Directory); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceNodeIsSpecialWebReferencesFolder() |
||||
{ |
||||
Assert.AreEqual(SpecialFolder.WebReference, webReferenceNode.SpecialFolder); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceNodeType() |
||||
{ |
||||
Assert.IsTrue(webReferenceNode is WebReferenceNode); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceNodeDirectory() |
||||
{ |
||||
Assert.AreEqual(Path.Combine(projectDirectory, "Web References\\localhost"), webReferenceNode.Directory); |
||||
} |
||||
|
||||
[Test] |
||||
public void MissingWebReferencesFolderNodeIsMissing() |
||||
{ |
||||
Assert.AreEqual(FileNodeStatus.Missing, missingWebReferencesFolderNode.FileNodeStatus); |
||||
} |
||||
|
||||
[Test] |
||||
public void MissingWebReferencesFolderNodeIsSpecialWebReferencesFolder() |
||||
{ |
||||
Assert.AreEqual(SpecialFolder.WebReferencesFolder, missingWebReferencesFolderNode.SpecialFolder); |
||||
} |
||||
|
||||
[Test] |
||||
public void MissingWebReferencesFolderNodeType() |
||||
{ |
||||
Assert.IsTrue(missingWebReferencesFolderNode is WebReferencesFolderNode); |
||||
} |
||||
|
||||
[Test] |
||||
public void MissingOrdinaryFolderNodeIsMissing() |
||||
{ |
||||
Assert.AreEqual(FileNodeStatus.Missing, missingOrdinaryFolderNode.FileNodeStatus); |
||||
} |
||||
|
||||
[Test] |
||||
public void MissingOrdinaryFolderNodeIsNotSpecialFolder() |
||||
{ |
||||
Assert.AreEqual(SpecialFolder.None, missingOrdinaryFolderNode.SpecialFolder); |
||||
} |
||||
|
||||
[Test] |
||||
public void MissingOrdinaryFolderNodeType() |
||||
{ |
||||
Assert.IsTrue(missingOrdinaryFolderNode is DirectoryNode); |
||||
} |
||||
|
||||
[Test] |
||||
public void MissingOrdinaryFolderName() |
||||
{ |
||||
Assert.AreEqual("c:\\projects\\test\\MissingFolder", missingOrdinaryFolderNode.Directory); |
||||
} |
||||
|
||||
[Test] |
||||
public void MissingOrdinaryFolderProjectItemExists() |
||||
{ |
||||
Assert.IsNotNull(missingOrdinaryFolderNode.ProjectItem); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using NUnit.Framework;
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// [TestFixture]
|
||||
// public class DirectoryNodeFactoryTests
|
||||
// {
|
||||
// DirectoryNode appDesignerFolderNode;
|
||||
// DirectoryNode ordinaryFolderNode;
|
||||
// DirectoryNode webReferencesFolderNode;
|
||||
// DirectoryNode missingWebReferencesFolderNode;
|
||||
// DirectoryNode missingOrdinaryFolderNode;
|
||||
// DirectoryNode webReferenceNode;
|
||||
//
|
||||
// string projectDirectory = "c:\\projects\\test";
|
||||
//
|
||||
// [TestFixtureSetUp]
|
||||
// public void SetUpFixture()
|
||||
// {
|
||||
// MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// project.FileName = Path.Combine(projectDirectory, "foo.csproj");
|
||||
// project.AppDesignerFolder = "Properties";
|
||||
//
|
||||
// WebReferencesProjectItem webReferencesItem = new WebReferencesProjectItem(project);
|
||||
// webReferencesItem.Include = "Web References\\";
|
||||
// ProjectService.AddProjectItem(project, webReferencesItem);
|
||||
//
|
||||
// FileProjectItem fileItem = new FileProjectItem(project, ItemType.Folder);
|
||||
// fileItem.Include = "MissingFolder\\";
|
||||
// ProjectService.AddProjectItem(project, fileItem);
|
||||
//
|
||||
// ProjectNode projectNode = new ProjectNode(project);
|
||||
//
|
||||
// appDesignerFolderNode = DirectoryNodeFactory.CreateDirectoryNode(projectNode, project, Path.Combine(projectDirectory, "Properties"));
|
||||
// ordinaryFolderNode = DirectoryNodeFactory.CreateDirectoryNode(projectNode, project, Path.Combine(project.Directory, "Test"));
|
||||
// webReferencesFolderNode = DirectoryNodeFactory.CreateDirectoryNode(projectNode, project, Path.Combine(project.Directory, webReferencesItem.Include));
|
||||
// webReferenceNode = DirectoryNodeFactory.CreateDirectoryNode(webReferencesFolderNode, project, Path.Combine(Path.Combine(project.Directory, webReferencesItem.Include), "localhost"));
|
||||
//
|
||||
// missingWebReferencesFolderNode = DirectoryNodeFactory.CreateDirectoryNode(webReferencesItem, FileNodeStatus.Missing);
|
||||
// missingOrdinaryFolderNode = DirectoryNodeFactory.CreateDirectoryNode(fileItem, FileNodeStatus.Missing);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void AppDesignerFolderNodeIsSpecialAppDesignerFolder()
|
||||
// {
|
||||
// Assert.AreEqual(SpecialFolder.AppDesigner, appDesignerFolderNode.SpecialFolder);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void AppDesignerFolderNodeDirectory()
|
||||
// {
|
||||
// Assert.AreEqual(Path.Combine(projectDirectory, "Properties"), appDesignerFolderNode.Directory);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OrdinaryFolderNodeIsNotSpecialFolder()
|
||||
// {
|
||||
// Assert.AreEqual(SpecialFolder.None, ordinaryFolderNode.SpecialFolder);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OrdinaryFolderNodeDirectory()
|
||||
// {
|
||||
// Assert.AreEqual(Path.Combine(projectDirectory, "Test"), ordinaryFolderNode.Directory);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OrdinaryFolderNodeType()
|
||||
// {
|
||||
// Assert.IsTrue(ordinaryFolderNode is DirectoryNode);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferencesFolderNodeIsSpecialWebReferencesFolder()
|
||||
// {
|
||||
// Assert.AreEqual(SpecialFolder.WebReferencesFolder, webReferencesFolderNode.SpecialFolder);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferencesFolderNodeType()
|
||||
// {
|
||||
// Assert.IsTrue(webReferencesFolderNode is WebReferencesFolderNode);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferencesFolderNodeDirectory()
|
||||
// {
|
||||
// Assert.AreEqual(Path.Combine(projectDirectory, "Web References\\"), webReferencesFolderNode.Directory);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceNodeIsSpecialWebReferencesFolder()
|
||||
// {
|
||||
// Assert.AreEqual(SpecialFolder.WebReference, webReferenceNode.SpecialFolder);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceNodeType()
|
||||
// {
|
||||
// Assert.IsTrue(webReferenceNode is WebReferenceNode);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceNodeDirectory()
|
||||
// {
|
||||
// Assert.AreEqual(Path.Combine(projectDirectory, "Web References\\localhost"), webReferenceNode.Directory);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void MissingWebReferencesFolderNodeIsMissing()
|
||||
// {
|
||||
// Assert.AreEqual(FileNodeStatus.Missing, missingWebReferencesFolderNode.FileNodeStatus);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void MissingWebReferencesFolderNodeIsSpecialWebReferencesFolder()
|
||||
// {
|
||||
// Assert.AreEqual(SpecialFolder.WebReferencesFolder, missingWebReferencesFolderNode.SpecialFolder);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void MissingWebReferencesFolderNodeType()
|
||||
// {
|
||||
// Assert.IsTrue(missingWebReferencesFolderNode is WebReferencesFolderNode);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void MissingOrdinaryFolderNodeIsMissing()
|
||||
// {
|
||||
// Assert.AreEqual(FileNodeStatus.Missing, missingOrdinaryFolderNode.FileNodeStatus);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void MissingOrdinaryFolderNodeIsNotSpecialFolder()
|
||||
// {
|
||||
// Assert.AreEqual(SpecialFolder.None, missingOrdinaryFolderNode.SpecialFolder);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void MissingOrdinaryFolderNodeType()
|
||||
// {
|
||||
// Assert.IsTrue(missingOrdinaryFolderNode is DirectoryNode);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void MissingOrdinaryFolderName()
|
||||
// {
|
||||
// Assert.AreEqual("c:\\projects\\test\\MissingFolder", missingOrdinaryFolderNode.Directory);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void MissingOrdinaryFolderProjectItemExists()
|
||||
// {
|
||||
// Assert.IsNotNull(missingOrdinaryFolderNode.ProjectItem);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,42 +1,43 @@
@@ -1,42 +1,43 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using System; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
/// <summary>
|
||||
/// Tests the DirectoryNode.IsWebReferencesFolder method.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class IsWebReferencesFolderTests |
||||
{ |
||||
[Test] |
||||
public void IsWebReferencesFolder1() |
||||
{ |
||||
MSBuildBasedProject p = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
p.FileName = "C:\\projects\\test\\foo.csproj"; |
||||
WebReferencesProjectItem item = new WebReferencesProjectItem(p); |
||||
item.Include = "Web References\\"; |
||||
ProjectService.AddProjectItem(p, item); |
||||
|
||||
Assert.IsTrue(DirectoryNode.IsWebReferencesFolder(p, "C:\\projects\\test\\Web References")); |
||||
} |
||||
|
||||
[Test] |
||||
public void IsNotWebReferencesFolder1() |
||||
{ |
||||
MSBuildBasedProject p = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
p.FileName = "C:\\projects\\test\\foo.csproj"; |
||||
WebReferencesProjectItem item = new WebReferencesProjectItem(p); |
||||
item.Include = "Web References\\"; |
||||
ProjectService.AddProjectItem(p, item); |
||||
|
||||
Assert.IsFalse(DirectoryNode.IsWebReferencesFolder(p, "C:\\projects\\test\\foo")); |
||||
} |
||||
|
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//using System;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests the DirectoryNode.IsWebReferencesFolder method.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class IsWebReferencesFolderTests
|
||||
// {
|
||||
// [Test]
|
||||
// public void IsWebReferencesFolder1()
|
||||
// {
|
||||
// MSBuildBasedProject p = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// p.FileName = "C:\\projects\\test\\foo.csproj";
|
||||
// WebReferencesProjectItem item = new WebReferencesProjectItem(p);
|
||||
// item.Include = "Web References\\";
|
||||
// ProjectService.AddProjectItem(p, item);
|
||||
//
|
||||
// Assert.IsTrue(DirectoryNode.IsWebReferencesFolder(p, "C:\\projects\\test\\Web References"));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void IsNotWebReferencesFolder1()
|
||||
// {
|
||||
// MSBuildBasedProject p = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// p.FileName = "C:\\projects\\test\\foo.csproj";
|
||||
// WebReferencesProjectItem item = new WebReferencesProjectItem(p);
|
||||
// item.Include = "Web References\\";
|
||||
// ProjectService.AddProjectItem(p, item);
|
||||
//
|
||||
// Assert.IsFalse(DirectoryNode.IsWebReferencesFolder(p, "C:\\projects\\test\\foo"));
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,70 +1,71 @@
@@ -1,70 +1,71 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop; |
||||
using SD = ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.IO; |
||||
using System.Collections.Generic; |
||||
using System.Web.Services.Description; |
||||
using System.Web.Services.Discovery; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
/// <summary>
|
||||
/// Tests that a new web reference does not generate a WebReferencesProjectItem
|
||||
/// if the project already contains a web reference folder.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class ProjectHasExistingWebRefFolderTest |
||||
{ |
||||
SD.WebReference webReference; |
||||
DiscoveryClientProtocol protocol; |
||||
ProjectItem webReferencesProjectItem; |
||||
MSBuildBasedProject project; |
||||
|
||||
string name = "localhost"; |
||||
string proxyNamespace = "WebReferenceNamespace"; |
||||
string updateFromUrl = "http://localhost/test.asmx"; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
WebReferencesProjectItem item = new WebReferencesProjectItem(project); |
||||
item.Include = "Web References\\"; |
||||
ProjectService.AddProjectItem(project, item); |
||||
|
||||
protocol = new DiscoveryClientProtocol(); |
||||
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference(); |
||||
discoveryRef.Url = updateFromUrl; |
||||
protocol.References.Add(discoveryRef); |
||||
|
||||
ContractReference contractRef = new ContractReference(); |
||||
contractRef.Url = "http://localhost/test.asmx?wsdl"; |
||||
contractRef.ClientProtocol = new DiscoveryClientProtocol(); |
||||
ServiceDescription desc = new ServiceDescription(); |
||||
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc); |
||||
protocol.References.Add(contractRef); |
||||
|
||||
WebReferenceTestHelper.InitializeProjectBindings(); |
||||
|
||||
webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol); |
||||
webReferencesProjectItem = WebReferenceTestHelper.GetProjectItem(webReference.Items, "Web References\\", ItemType.WebReferences); |
||||
} |
||||
|
||||
[Test] |
||||
public void ProjectItemContainsWebReferencesFolder() |
||||
{ |
||||
Assert.IsTrue(SD.WebReference.ProjectContainsWebReferencesFolder(project)); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferencesProjectItemDoesNotExist() |
||||
{ |
||||
Assert.IsNull(webReferencesProjectItem); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop;
|
||||
//using SD = ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Web.Services.Description;
|
||||
//using System.Web.Services.Discovery;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests that a new web reference does not generate a WebReferencesProjectItem
|
||||
// /// if the project already contains a web reference folder.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class ProjectHasExistingWebRefFolderTest
|
||||
// {
|
||||
// SD.WebReference webReference;
|
||||
// DiscoveryClientProtocol protocol;
|
||||
// ProjectItem webReferencesProjectItem;
|
||||
// MSBuildBasedProject project;
|
||||
//
|
||||
// string name = "localhost";
|
||||
// string proxyNamespace = "WebReferenceNamespace";
|
||||
// string updateFromUrl = "http://localhost/test.asmx";
|
||||
//
|
||||
// [TestFixtureSetUp]
|
||||
// public void SetUpFixture()
|
||||
// {
|
||||
// project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// WebReferencesProjectItem item = new WebReferencesProjectItem(project);
|
||||
// item.Include = "Web References\\";
|
||||
// ProjectService.AddProjectItem(project, item);
|
||||
//
|
||||
// protocol = new DiscoveryClientProtocol();
|
||||
// DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
|
||||
// discoveryRef.Url = updateFromUrl;
|
||||
// protocol.References.Add(discoveryRef);
|
||||
//
|
||||
// ContractReference contractRef = new ContractReference();
|
||||
// contractRef.Url = "http://localhost/test.asmx?wsdl";
|
||||
// contractRef.ClientProtocol = new DiscoveryClientProtocol();
|
||||
// ServiceDescription desc = new ServiceDescription();
|
||||
// contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
|
||||
// protocol.References.Add(contractRef);
|
||||
//
|
||||
// WebReferenceTestHelper.InitializeProjectBindings();
|
||||
//
|
||||
// webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
|
||||
// webReferencesProjectItem = WebReferenceTestHelper.GetProjectItem(webReference.Items, "Web References\\", ItemType.WebReferences);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ProjectItemContainsWebReferencesFolder()
|
||||
// {
|
||||
// Assert.IsTrue(SD.WebReference.ProjectContainsWebReferencesFolder(project));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferencesProjectItemDoesNotExist()
|
||||
// {
|
||||
// Assert.IsNull(webReferencesProjectItem);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,89 +1,90 @@
@@ -1,89 +1,90 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
/// <summary>
|
||||
/// Tests the WebReference.GetProjectItems method returns the
|
||||
/// correct project items from a project.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class ProjectWebReferenceItemsTests |
||||
{ |
||||
List<ProjectItem> projectItems; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
project.FileName = "c:\\projects\\test\\foo.csproj"; |
||||
|
||||
// Web references item.
|
||||
WebReferencesProjectItem webReferencesItem = new WebReferencesProjectItem(project); |
||||
webReferencesItem.Include = "Web References\\"; |
||||
ProjectService.AddProjectItem(project, webReferencesItem); |
||||
|
||||
// Web reference url.
|
||||
WebReferenceUrl webReferenceUrl = new WebReferenceUrl(project); |
||||
webReferenceUrl.Include = "http://localhost/test.asmx"; |
||||
webReferenceUrl.UpdateFromURL = "http://localhost/test.asmx"; |
||||
webReferenceUrl.RelPath = "Web References\\localhost"; |
||||
ProjectService.AddProjectItem(project, webReferenceUrl); |
||||
|
||||
FileProjectItem discoFileItem = new FileProjectItem(project, ItemType.None); |
||||
discoFileItem.Include = "Web References\\localhost\\test.disco"; |
||||
ProjectService.AddProjectItem(project, discoFileItem); |
||||
|
||||
FileProjectItem wsdlFileItem = new FileProjectItem(project, ItemType.None); |
||||
wsdlFileItem.Include = "Web References\\localhost\\test.wsdl"; |
||||
ProjectService.AddProjectItem(project, wsdlFileItem); |
||||
|
||||
// Proxy
|
||||
FileProjectItem proxyItem = new FileProjectItem(project, ItemType.Compile); |
||||
proxyItem.Include = "Web References\\localhost\\Reference.cs"; |
||||
proxyItem.DependentUpon = "Reference.map"; |
||||
ProjectService.AddProjectItem(project, proxyItem); |
||||
|
||||
// Reference map.
|
||||
FileProjectItem mapItem = new FileProjectItem(project, ItemType.None); |
||||
mapItem.Include = "Web References\\localhost\\Reference.map"; |
||||
ProjectService.AddProjectItem(project, mapItem); |
||||
|
||||
// System.Web.Services reference.
|
||||
ReferenceProjectItem webServicesReferenceItem = new ReferenceProjectItem(project, "System.Web.Services"); |
||||
ProjectService.AddProjectItem(project, webServicesReferenceItem); |
||||
|
||||
projectItems = WebReference.GetFileItems(project, "localhost"); |
||||
} |
||||
|
||||
[Test] |
||||
public void ReferenceMapFileItemFound() |
||||
{ |
||||
Assert.IsNotNull(WebReferenceTestHelper.GetProjectItem(projectItems, "Web References\\localhost\\Reference.map", ItemType.None)); |
||||
} |
||||
|
||||
[Test] |
||||
public void ProxyFileItemFound() |
||||
{ |
||||
Assert.IsNotNull(WebReferenceTestHelper.GetProjectItem(projectItems, "Web References\\localhost\\Reference.cs", ItemType.Compile)); |
||||
} |
||||
|
||||
[Test] |
||||
public void WsdlFileItemFound() |
||||
{ |
||||
Assert.IsNotNull(WebReferenceTestHelper.GetProjectItem(projectItems, "Web References\\localhost\\test.wsdl", ItemType.None)); |
||||
} |
||||
|
||||
[Test] |
||||
public void DiscoFileItemFound() |
||||
{ |
||||
Assert.IsNotNull(WebReferenceTestHelper.GetProjectItem(projectItems, "Web References\\localhost\\test.disco", ItemType.None)); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests the WebReference.GetProjectItems method returns the
|
||||
// /// correct project items from a project.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class ProjectWebReferenceItemsTests
|
||||
// {
|
||||
// List<ProjectItem> projectItems;
|
||||
//
|
||||
// [TestFixtureSetUp]
|
||||
// public void SetUpFixture()
|
||||
// {
|
||||
// MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// project.FileName = "c:\\projects\\test\\foo.csproj";
|
||||
//
|
||||
// // Web references item.
|
||||
// WebReferencesProjectItem webReferencesItem = new WebReferencesProjectItem(project);
|
||||
// webReferencesItem.Include = "Web References\\";
|
||||
// ProjectService.AddProjectItem(project, webReferencesItem);
|
||||
//
|
||||
// // Web reference url.
|
||||
// WebReferenceUrl webReferenceUrl = new WebReferenceUrl(project);
|
||||
// webReferenceUrl.Include = "http://localhost/test.asmx";
|
||||
// webReferenceUrl.UpdateFromURL = "http://localhost/test.asmx";
|
||||
// webReferenceUrl.RelPath = "Web References\\localhost";
|
||||
// ProjectService.AddProjectItem(project, webReferenceUrl);
|
||||
//
|
||||
// FileProjectItem discoFileItem = new FileProjectItem(project, ItemType.None);
|
||||
// discoFileItem.Include = "Web References\\localhost\\test.disco";
|
||||
// ProjectService.AddProjectItem(project, discoFileItem);
|
||||
//
|
||||
// FileProjectItem wsdlFileItem = new FileProjectItem(project, ItemType.None);
|
||||
// wsdlFileItem.Include = "Web References\\localhost\\test.wsdl";
|
||||
// ProjectService.AddProjectItem(project, wsdlFileItem);
|
||||
//
|
||||
// // Proxy
|
||||
// FileProjectItem proxyItem = new FileProjectItem(project, ItemType.Compile);
|
||||
// proxyItem.Include = "Web References\\localhost\\Reference.cs";
|
||||
// proxyItem.DependentUpon = "Reference.map";
|
||||
// ProjectService.AddProjectItem(project, proxyItem);
|
||||
//
|
||||
// // Reference map.
|
||||
// FileProjectItem mapItem = new FileProjectItem(project, ItemType.None);
|
||||
// mapItem.Include = "Web References\\localhost\\Reference.map";
|
||||
// ProjectService.AddProjectItem(project, mapItem);
|
||||
//
|
||||
// // System.Web.Services reference.
|
||||
// ReferenceProjectItem webServicesReferenceItem = new ReferenceProjectItem(project, "System.Web.Services");
|
||||
// ProjectService.AddProjectItem(project, webServicesReferenceItem);
|
||||
//
|
||||
// projectItems = WebReference.GetFileItems(project, "localhost");
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ReferenceMapFileItemFound()
|
||||
// {
|
||||
// Assert.IsNotNull(WebReferenceTestHelper.GetProjectItem(projectItems, "Web References\\localhost\\Reference.map", ItemType.None));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ProxyFileItemFound()
|
||||
// {
|
||||
// Assert.IsNotNull(WebReferenceTestHelper.GetProjectItem(projectItems, "Web References\\localhost\\Reference.cs", ItemType.Compile));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WsdlFileItemFound()
|
||||
// {
|
||||
// Assert.IsNotNull(WebReferenceTestHelper.GetProjectItem(projectItems, "Web References\\localhost\\test.wsdl", ItemType.None));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void DiscoFileItemFound()
|
||||
// {
|
||||
// Assert.IsNotNull(WebReferenceTestHelper.GetProjectItem(projectItems, "Web References\\localhost\\test.disco", ItemType.None));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,61 +1,62 @@
@@ -1,61 +1,62 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
using SD = ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.IO; |
||||
using System.Collections.Generic; |
||||
using System.Web.Services.Description; |
||||
using System.Web.Services.Discovery; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
/// <summary>
|
||||
/// Non-standard web references folder name.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class RenamedWebReferencesFolderTest |
||||
{ |
||||
SD.WebReference webReference; |
||||
DiscoveryClientProtocol protocol; |
||||
MSBuildBasedProject project; |
||||
WebReferenceUrl webReferenceUrl; |
||||
|
||||
string name = "localhost"; |
||||
string proxyNamespace = "WebReferenceNamespace"; |
||||
string updateFromUrl = "http://localhost/test.asmx"; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetupFixture() |
||||
{ |
||||
project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
project.FileName = "C:\\Projects\\Web.csproj"; |
||||
WebReferencesProjectItem item = new WebReferencesProjectItem(project); |
||||
item.Include = "Foo\\"; |
||||
ProjectService.AddProjectItem(project, item); |
||||
|
||||
protocol = new DiscoveryClientProtocol(); |
||||
|
||||
WebReferenceTestHelper.InitializeProjectBindings(); |
||||
|
||||
webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol); |
||||
webReferenceUrl = (WebReferenceUrl)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.WebReferenceUrl); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceRelativePath() |
||||
{ |
||||
Assert.AreEqual("Foo\\localhost", webReferenceUrl.RelPath); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferencesFolder() |
||||
{ |
||||
Assert.AreEqual("C:\\Projects\\Foo", webReference.WebReferencesDirectory); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.SharpDevelop;
|
||||
//using SD = ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Web.Services.Description;
|
||||
//using System.Web.Services.Discovery;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Non-standard web references folder name.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class RenamedWebReferencesFolderTest
|
||||
// {
|
||||
// SD.WebReference webReference;
|
||||
// DiscoveryClientProtocol protocol;
|
||||
// MSBuildBasedProject project;
|
||||
// WebReferenceUrl webReferenceUrl;
|
||||
//
|
||||
// string name = "localhost";
|
||||
// string proxyNamespace = "WebReferenceNamespace";
|
||||
// string updateFromUrl = "http://localhost/test.asmx";
|
||||
//
|
||||
// [TestFixtureSetUp]
|
||||
// public void SetupFixture()
|
||||
// {
|
||||
// project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// project.FileName = "C:\\Projects\\Web.csproj";
|
||||
// WebReferencesProjectItem item = new WebReferencesProjectItem(project);
|
||||
// item.Include = "Foo\\";
|
||||
// ProjectService.AddProjectItem(project, item);
|
||||
//
|
||||
// protocol = new DiscoveryClientProtocol();
|
||||
//
|
||||
// WebReferenceTestHelper.InitializeProjectBindings();
|
||||
//
|
||||
// webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
|
||||
// webReferenceUrl = (WebReferenceUrl)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.WebReferenceUrl);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceRelativePath()
|
||||
// {
|
||||
// Assert.AreEqual("Foo\\localhost", webReferenceUrl.RelPath);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferencesFolder()
|
||||
// {
|
||||
// Assert.AreEqual("C:\\Projects\\Foo", webReference.WebReferencesDirectory);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,57 +1,58 @@
@@ -1,57 +1,58 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop; |
||||
using SD = ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.IO; |
||||
using System.Collections.Generic; |
||||
using System.Web.Services.Description; |
||||
using System.Web.Services.Discovery; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
/// <summary>
|
||||
/// Tests that an exception is thrown if an unsupported project language
|
||||
/// is used with the web reference
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class UnsupportedLanguageTest |
||||
{ |
||||
SD.WebReference webReference; |
||||
DiscoveryClientProtocol protocol; |
||||
FileProjectItem proxyFileProjectItem; |
||||
MSBuildBasedProject project; |
||||
|
||||
string name = "localhost"; |
||||
string proxyNamespace = "WebReferenceNamespace"; |
||||
string updateFromUrl = "http://localhost/test.asmx"; |
||||
|
||||
[Test] |
||||
[ExpectedException(typeof(NotSupportedException))] |
||||
public void NotSupportedProjectLanguage() |
||||
{ |
||||
project = WebReferenceTestHelper.CreateTestProject("Foo"); |
||||
|
||||
protocol = new DiscoveryClientProtocol(); |
||||
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference(); |
||||
discoveryRef.Url = updateFromUrl; |
||||
protocol.References.Add(discoveryRef); |
||||
|
||||
ContractReference contractRef = new ContractReference(); |
||||
contractRef.Url = "http://localhost/test.asmx?wsdl"; |
||||
contractRef.ClientProtocol = new DiscoveryClientProtocol(); |
||||
ServiceDescription desc = new ServiceDescription(); |
||||
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc); |
||||
protocol.References.Add(contractRef); |
||||
|
||||
WebReferenceTestHelper.InitializeProjectBindings(); |
||||
|
||||
webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol); |
||||
|
||||
proxyFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.vb", ItemType.Compile); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop;
|
||||
//using SD = ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Web.Services.Description;
|
||||
//using System.Web.Services.Discovery;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests that an exception is thrown if an unsupported project language
|
||||
// /// is used with the web reference
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class UnsupportedLanguageTest
|
||||
// {
|
||||
// SD.WebReference webReference;
|
||||
// DiscoveryClientProtocol protocol;
|
||||
// FileProjectItem proxyFileProjectItem;
|
||||
// MSBuildBasedProject project;
|
||||
//
|
||||
// string name = "localhost";
|
||||
// string proxyNamespace = "WebReferenceNamespace";
|
||||
// string updateFromUrl = "http://localhost/test.asmx";
|
||||
//
|
||||
// [Test]
|
||||
// [ExpectedException(typeof(NotSupportedException))]
|
||||
// public void NotSupportedProjectLanguage()
|
||||
// {
|
||||
// project = WebReferenceTestHelper.CreateTestProject("Foo");
|
||||
//
|
||||
// protocol = new DiscoveryClientProtocol();
|
||||
// DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
|
||||
// discoveryRef.Url = updateFromUrl;
|
||||
// protocol.References.Add(discoveryRef);
|
||||
//
|
||||
// ContractReference contractRef = new ContractReference();
|
||||
// contractRef.Url = "http://localhost/test.asmx?wsdl";
|
||||
// contractRef.ClientProtocol = new DiscoveryClientProtocol();
|
||||
// ServiceDescription desc = new ServiceDescription();
|
||||
// contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
|
||||
// protocol.References.Add(contractRef);
|
||||
//
|
||||
// WebReferenceTestHelper.InitializeProjectBindings();
|
||||
//
|
||||
// webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
|
||||
//
|
||||
// proxyFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.vb", ItemType.Compile);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,62 +1,63 @@
@@ -1,62 +1,63 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop; |
||||
using SD = ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.IO; |
||||
using System.Collections.Generic; |
||||
using System.Web.Services.Description; |
||||
using System.Web.Services.Discovery; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
/// <summary>
|
||||
/// Tests that the generated filename ends with .vb if the project is
|
||||
/// a vb project.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class VBNetWebReferenceTest |
||||
{ |
||||
SD.WebReference webReference; |
||||
DiscoveryClientProtocol protocol; |
||||
FileProjectItem proxyFileProjectItem; |
||||
MSBuildBasedProject project; |
||||
|
||||
string name = "localhost"; |
||||
string proxyNamespace = "WebReferenceNamespace"; |
||||
string updateFromUrl = "http://localhost/test.asmx"; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
project = WebReferenceTestHelper.CreateTestProject("VBNet"); |
||||
|
||||
protocol = new DiscoveryClientProtocol(); |
||||
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference(); |
||||
discoveryRef.Url = updateFromUrl; |
||||
protocol.References.Add(discoveryRef); |
||||
|
||||
ContractReference contractRef = new ContractReference(); |
||||
contractRef.Url = "http://localhost/test.asmx?wsdl"; |
||||
contractRef.ClientProtocol = new DiscoveryClientProtocol(); |
||||
ServiceDescription desc = new ServiceDescription(); |
||||
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc); |
||||
protocol.References.Add(contractRef); |
||||
|
||||
WebReferenceTestHelper.InitializeProjectBindings(); |
||||
|
||||
webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol); |
||||
|
||||
proxyFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.vb", ItemType.Compile); |
||||
} |
||||
|
||||
[Test] |
||||
public void VBProxyFileExists() |
||||
{ |
||||
Assert.IsNotNull(proxyFileProjectItem); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop;
|
||||
//using SD = ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Web.Services.Description;
|
||||
//using System.Web.Services.Discovery;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests that the generated filename ends with .vb if the project is
|
||||
// /// a vb project.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class VBNetWebReferenceTest
|
||||
// {
|
||||
// SD.WebReference webReference;
|
||||
// DiscoveryClientProtocol protocol;
|
||||
// FileProjectItem proxyFileProjectItem;
|
||||
// MSBuildBasedProject project;
|
||||
//
|
||||
// string name = "localhost";
|
||||
// string proxyNamespace = "WebReferenceNamespace";
|
||||
// string updateFromUrl = "http://localhost/test.asmx";
|
||||
//
|
||||
// [TestFixtureSetUp]
|
||||
// public void SetUpFixture()
|
||||
// {
|
||||
// project = WebReferenceTestHelper.CreateTestProject("VBNet");
|
||||
//
|
||||
// protocol = new DiscoveryClientProtocol();
|
||||
// DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
|
||||
// discoveryRef.Url = updateFromUrl;
|
||||
// protocol.References.Add(discoveryRef);
|
||||
//
|
||||
// ContractReference contractRef = new ContractReference();
|
||||
// contractRef.Url = "http://localhost/test.asmx?wsdl";
|
||||
// contractRef.ClientProtocol = new DiscoveryClientProtocol();
|
||||
// ServiceDescription desc = new ServiceDescription();
|
||||
// contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
|
||||
// protocol.References.Add(contractRef);
|
||||
//
|
||||
// WebReferenceTestHelper.InitializeProjectBindings();
|
||||
//
|
||||
// webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
|
||||
//
|
||||
// proxyFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.vb", ItemType.Compile);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void VBProxyFileExists()
|
||||
// {
|
||||
// Assert.IsNotNull(proxyFileProjectItem);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,124 +1,125 @@
@@ -1,124 +1,125 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using SD = ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.Web.Services.Description; |
||||
using System.Web.Services.Discovery; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
/// <summary>
|
||||
/// Tests the WebReferenceChanges class.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class WebReferenceChangesTest |
||||
{ |
||||
SD.WebReferenceChanges changes; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
// Set up the project.
|
||||
MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
project.FileName = "c:\\projects\\test\\foo.csproj"; |
||||
|
||||
// Web references item.
|
||||
WebReferencesProjectItem webReferencesItem = new WebReferencesProjectItem(project); |
||||
webReferencesItem.Include = "Web References\\"; |
||||
ProjectService.AddProjectItem(project, webReferencesItem); |
||||
|
||||
// Web reference url.
|
||||
WebReferenceUrl webReferenceUrl = new WebReferenceUrl(project); |
||||
webReferenceUrl.Include = "http://localhost/test.asmx"; |
||||
webReferenceUrl.UpdateFromURL = "http://localhost/test.asmx"; |
||||
webReferenceUrl.RelPath = "Web References\\localhost"; |
||||
ProjectService.AddProjectItem(project, webReferenceUrl); |
||||
|
||||
FileProjectItem discoFileItem = new FileProjectItem(project, ItemType.None); |
||||
discoFileItem.Include = "Web References\\localhost\\test.disco"; |
||||
ProjectService.AddProjectItem(project, discoFileItem); |
||||
|
||||
FileProjectItem wsdlFileItem = new FileProjectItem(project, ItemType.None); |
||||
wsdlFileItem.Include = "Web References\\localhost\\test.wsdl"; |
||||
ProjectService.AddProjectItem(project, wsdlFileItem); |
||||
|
||||
// Proxy
|
||||
FileProjectItem proxyItem = new FileProjectItem(project, ItemType.Compile); |
||||
proxyItem.Include = "Web References\\localhost\\Reference.cs"; |
||||
proxyItem.DependentUpon = "Reference.map"; |
||||
ProjectService.AddProjectItem(project, proxyItem); |
||||
|
||||
// Reference map.
|
||||
FileProjectItem mapItem = new FileProjectItem(project, ItemType.None); |
||||
mapItem.Include = "Web References\\localhost\\Reference.map"; |
||||
ProjectService.AddProjectItem(project, mapItem); |
||||
|
||||
// System.Web.Services reference.
|
||||
ReferenceProjectItem webServicesReferenceItem = new ReferenceProjectItem(project, "System.Web.Services"); |
||||
ProjectService.AddProjectItem(project, webServicesReferenceItem); |
||||
|
||||
// Set up the web reference.
|
||||
DiscoveryClientProtocol protocol = new DiscoveryClientProtocol(); |
||||
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference(); |
||||
discoveryRef.Url = "http://localhost/new.asmx"; |
||||
protocol.References.Add(discoveryRef); |
||||
|
||||
ContractReference contractRef = new ContractReference(); |
||||
contractRef.Url = "http://localhost/new.asmx?wsdl"; |
||||
contractRef.ClientProtocol = new DiscoveryClientProtocol(); |
||||
ServiceDescription desc = new ServiceDescription(); |
||||
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc); |
||||
protocol.References.Add(contractRef); |
||||
|
||||
WebReferenceTestHelper.InitializeProjectBindings(); |
||||
|
||||
SD.WebReference webReference = new SD.WebReference(project, "http://localhost/new.asmx", "localhost", "ProxyNamespace", protocol); |
||||
changes = webReference.GetChanges(project); |
||||
} |
||||
|
||||
[Test] |
||||
public void HasChanged() |
||||
{ |
||||
Assert.IsTrue(changes.Changed); |
||||
} |
||||
|
||||
[Test] |
||||
public void HasNewWsdlFile() |
||||
{ |
||||
Assert.IsNotNull(WebReferenceTestHelper.GetFileProjectItem(changes.NewItems, "Web References\\localhost\\new.wsdl", ItemType.None)); |
||||
} |
||||
|
||||
[Test] |
||||
public void HasNewDiscoFile() |
||||
{ |
||||
Assert.IsNotNull(WebReferenceTestHelper.GetFileProjectItem(changes.NewItems, "Web References\\localhost\\new.disco", ItemType.None)); |
||||
} |
||||
|
||||
[Test] |
||||
public void OldWsdlFileRemoved() |
||||
{ |
||||
Assert.IsNotNull(WebReferenceTestHelper.GetFileProjectItem(changes.ItemsRemoved, "Web References\\localhost\\test.wsdl", ItemType.None)); |
||||
} |
||||
|
||||
[Test] |
||||
public void OldDiscoFileRemoved() |
||||
{ |
||||
Assert.IsNotNull(WebReferenceTestHelper.GetFileProjectItem(changes.ItemsRemoved, "Web References\\localhost\\test.disco", ItemType.None)); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceUrlNotConsideredNewItem() |
||||
{ |
||||
Assert.IsNull(WebReferenceTestHelper.GetProjectItem(changes.NewItems, ItemType.WebReferenceUrl)); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceUrlNotConsideredRemoved() |
||||
{ |
||||
Assert.IsNull(WebReferenceTestHelper.GetProjectItem(changes.ItemsRemoved, ItemType.WebReferenceUrl)); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using SD = ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//using System;
|
||||
//using System.Web.Services.Description;
|
||||
//using System.Web.Services.Discovery;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests the WebReferenceChanges class.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class WebReferenceChangesTest
|
||||
// {
|
||||
// SD.WebReferenceChanges changes;
|
||||
//
|
||||
// [TestFixtureSetUp]
|
||||
// public void SetUpFixture()
|
||||
// {
|
||||
// // Set up the project.
|
||||
// MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// project.FileName = "c:\\projects\\test\\foo.csproj";
|
||||
//
|
||||
// // Web references item.
|
||||
// WebReferencesProjectItem webReferencesItem = new WebReferencesProjectItem(project);
|
||||
// webReferencesItem.Include = "Web References\\";
|
||||
// ProjectService.AddProjectItem(project, webReferencesItem);
|
||||
//
|
||||
// // Web reference url.
|
||||
// WebReferenceUrl webReferenceUrl = new WebReferenceUrl(project);
|
||||
// webReferenceUrl.Include = "http://localhost/test.asmx";
|
||||
// webReferenceUrl.UpdateFromURL = "http://localhost/test.asmx";
|
||||
// webReferenceUrl.RelPath = "Web References\\localhost";
|
||||
// ProjectService.AddProjectItem(project, webReferenceUrl);
|
||||
//
|
||||
// FileProjectItem discoFileItem = new FileProjectItem(project, ItemType.None);
|
||||
// discoFileItem.Include = "Web References\\localhost\\test.disco";
|
||||
// ProjectService.AddProjectItem(project, discoFileItem);
|
||||
//
|
||||
// FileProjectItem wsdlFileItem = new FileProjectItem(project, ItemType.None);
|
||||
// wsdlFileItem.Include = "Web References\\localhost\\test.wsdl";
|
||||
// ProjectService.AddProjectItem(project, wsdlFileItem);
|
||||
//
|
||||
// // Proxy
|
||||
// FileProjectItem proxyItem = new FileProjectItem(project, ItemType.Compile);
|
||||
// proxyItem.Include = "Web References\\localhost\\Reference.cs";
|
||||
// proxyItem.DependentUpon = "Reference.map";
|
||||
// ProjectService.AddProjectItem(project, proxyItem);
|
||||
//
|
||||
// // Reference map.
|
||||
// FileProjectItem mapItem = new FileProjectItem(project, ItemType.None);
|
||||
// mapItem.Include = "Web References\\localhost\\Reference.map";
|
||||
// ProjectService.AddProjectItem(project, mapItem);
|
||||
//
|
||||
// // System.Web.Services reference.
|
||||
// ReferenceProjectItem webServicesReferenceItem = new ReferenceProjectItem(project, "System.Web.Services");
|
||||
// ProjectService.AddProjectItem(project, webServicesReferenceItem);
|
||||
//
|
||||
// // Set up the web reference.
|
||||
// DiscoveryClientProtocol protocol = new DiscoveryClientProtocol();
|
||||
// DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
|
||||
// discoveryRef.Url = "http://localhost/new.asmx";
|
||||
// protocol.References.Add(discoveryRef);
|
||||
//
|
||||
// ContractReference contractRef = new ContractReference();
|
||||
// contractRef.Url = "http://localhost/new.asmx?wsdl";
|
||||
// contractRef.ClientProtocol = new DiscoveryClientProtocol();
|
||||
// ServiceDescription desc = new ServiceDescription();
|
||||
// contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
|
||||
// protocol.References.Add(contractRef);
|
||||
//
|
||||
// WebReferenceTestHelper.InitializeProjectBindings();
|
||||
//
|
||||
// SD.WebReference webReference = new SD.WebReference(project, "http://localhost/new.asmx", "localhost", "ProxyNamespace", protocol);
|
||||
// changes = webReference.GetChanges(project);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void HasChanged()
|
||||
// {
|
||||
// Assert.IsTrue(changes.Changed);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void HasNewWsdlFile()
|
||||
// {
|
||||
// Assert.IsNotNull(WebReferenceTestHelper.GetFileProjectItem(changes.NewItems, "Web References\\localhost\\new.wsdl", ItemType.None));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void HasNewDiscoFile()
|
||||
// {
|
||||
// Assert.IsNotNull(WebReferenceTestHelper.GetFileProjectItem(changes.NewItems, "Web References\\localhost\\new.disco", ItemType.None));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OldWsdlFileRemoved()
|
||||
// {
|
||||
// Assert.IsNotNull(WebReferenceTestHelper.GetFileProjectItem(changes.ItemsRemoved, "Web References\\localhost\\test.wsdl", ItemType.None));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void OldDiscoFileRemoved()
|
||||
// {
|
||||
// Assert.IsNotNull(WebReferenceTestHelper.GetFileProjectItem(changes.ItemsRemoved, "Web References\\localhost\\test.disco", ItemType.None));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceUrlNotConsideredNewItem()
|
||||
// {
|
||||
// Assert.IsNull(WebReferenceTestHelper.GetProjectItem(changes.NewItems, ItemType.WebReferenceUrl));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceUrlNotConsideredRemoved()
|
||||
// {
|
||||
// Assert.IsNull(WebReferenceTestHelper.GetProjectItem(changes.ItemsRemoved, ItemType.WebReferenceUrl));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,124 +1,125 @@
@@ -1,124 +1,125 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
using SD = ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.IO; |
||||
using System.Collections.Generic; |
||||
using System.Web.Services.Description; |
||||
using System.Web.Services.Discovery; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
/// <summary>
|
||||
/// Checks that the web reference folder name is changed if
|
||||
/// one exists with the same name.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class WebReferenceFolderAlreadyExistsTest |
||||
{ |
||||
SD.WebReference webReference; |
||||
DiscoveryClientProtocol protocol; |
||||
MSBuildBasedProject project; |
||||
WebReferenceUrl webReferenceUrl; |
||||
FileProjectItem discoFileProjectItem; |
||||
FileProjectItem referenceMapFileProjectItem; |
||||
FileProjectItem wsdlFileProjectItem; |
||||
FileProjectItem proxyFileProjectItem; |
||||
|
||||
string oldName = "localhost"; |
||||
string name = "localhost1"; |
||||
string proxyNamespace = "WebReferenceNamespace"; |
||||
string updateFromUrl = "http://localhost/test.asmx"; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetupFixture() |
||||
{ |
||||
project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
project.FileName = "C:\\Projects\\Web.csproj"; |
||||
WebReferencesProjectItem item = new WebReferencesProjectItem(project); |
||||
item.Include = "Web References\\"; |
||||
ProjectService.AddProjectItem(project, item); |
||||
|
||||
protocol = new DiscoveryClientProtocol(); |
||||
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference(); |
||||
discoveryRef.Url = updateFromUrl; |
||||
protocol.References.Add(discoveryRef); |
||||
|
||||
ContractReference contractRef = new ContractReference(); |
||||
contractRef.Url = "http://localhost/test.asmx?wsdl"; |
||||
contractRef.ClientProtocol = new DiscoveryClientProtocol(); |
||||
ServiceDescription desc = new ServiceDescription(); |
||||
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc); |
||||
protocol.References.Add(contractRef); |
||||
|
||||
WebReferenceTestHelper.InitializeProjectBindings(); |
||||
|
||||
webReference = new SD.WebReference(project, updateFromUrl, oldName, proxyNamespace, protocol); |
||||
|
||||
// Force generation of items.
|
||||
List<ProjectItem> items = webReference.Items; |
||||
|
||||
// Change the web reference name.
|
||||
webReference.Name = name; |
||||
webReferenceUrl = (WebReferenceUrl)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.WebReferenceUrl); |
||||
|
||||
discoFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost1\\test.disco", ItemType.None); |
||||
referenceMapFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost1\\Reference.map", ItemType.None); |
||||
wsdlFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost1\\test.wsdl", ItemType.None); |
||||
proxyFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost1\\Reference.cs", ItemType.Compile); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceRelativePath() |
||||
{ |
||||
Assert.AreEqual("Web References\\localhost1", webReferenceUrl.RelPath); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceName() |
||||
{ |
||||
Assert.AreEqual(name, webReference.Name); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceDirectory() |
||||
{ |
||||
Assert.AreEqual(Path.Combine(project.Directory, "Web References\\localhost1"), webReference.Directory); |
||||
} |
||||
|
||||
[Test] |
||||
public void ProxyFileName() |
||||
{ |
||||
Assert.AreEqual("C:\\Projects\\Web References\\localhost1\\Reference.cs", webReference.WebProxyFileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void DiscoFileItemExists() |
||||
{ |
||||
Assert.IsNotNull(discoFileProjectItem); |
||||
} |
||||
|
||||
[Test] |
||||
public void WsdlFileItemExists() |
||||
{ |
||||
Assert.IsNotNull(wsdlFileProjectItem); |
||||
} |
||||
|
||||
[Test] |
||||
public void ReferenceMapFileItemExists() |
||||
{ |
||||
Assert.IsNotNull(referenceMapFileProjectItem); |
||||
} |
||||
|
||||
[Test] |
||||
public void ProxyFileItemExists() |
||||
{ |
||||
Assert.IsNotNull(proxyFileProjectItem); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.SharpDevelop;
|
||||
//using SD = ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Web.Services.Description;
|
||||
//using System.Web.Services.Discovery;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Checks that the web reference folder name is changed if
|
||||
// /// one exists with the same name.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class WebReferenceFolderAlreadyExistsTest
|
||||
// {
|
||||
// SD.WebReference webReference;
|
||||
// DiscoveryClientProtocol protocol;
|
||||
// MSBuildBasedProject project;
|
||||
// WebReferenceUrl webReferenceUrl;
|
||||
// FileProjectItem discoFileProjectItem;
|
||||
// FileProjectItem referenceMapFileProjectItem;
|
||||
// FileProjectItem wsdlFileProjectItem;
|
||||
// FileProjectItem proxyFileProjectItem;
|
||||
//
|
||||
// string oldName = "localhost";
|
||||
// string name = "localhost1";
|
||||
// string proxyNamespace = "WebReferenceNamespace";
|
||||
// string updateFromUrl = "http://localhost/test.asmx";
|
||||
//
|
||||
// [TestFixtureSetUp]
|
||||
// public void SetupFixture()
|
||||
// {
|
||||
// project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// project.FileName = "C:\\Projects\\Web.csproj";
|
||||
// WebReferencesProjectItem item = new WebReferencesProjectItem(project);
|
||||
// item.Include = "Web References\\";
|
||||
// ProjectService.AddProjectItem(project, item);
|
||||
//
|
||||
// protocol = new DiscoveryClientProtocol();
|
||||
// DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
|
||||
// discoveryRef.Url = updateFromUrl;
|
||||
// protocol.References.Add(discoveryRef);
|
||||
//
|
||||
// ContractReference contractRef = new ContractReference();
|
||||
// contractRef.Url = "http://localhost/test.asmx?wsdl";
|
||||
// contractRef.ClientProtocol = new DiscoveryClientProtocol();
|
||||
// ServiceDescription desc = new ServiceDescription();
|
||||
// contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
|
||||
// protocol.References.Add(contractRef);
|
||||
//
|
||||
// WebReferenceTestHelper.InitializeProjectBindings();
|
||||
//
|
||||
// webReference = new SD.WebReference(project, updateFromUrl, oldName, proxyNamespace, protocol);
|
||||
//
|
||||
// // Force generation of items.
|
||||
// List<ProjectItem> items = webReference.Items;
|
||||
//
|
||||
// // Change the web reference name.
|
||||
// webReference.Name = name;
|
||||
// webReferenceUrl = (WebReferenceUrl)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.WebReferenceUrl);
|
||||
//
|
||||
// discoFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost1\\test.disco", ItemType.None);
|
||||
// referenceMapFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost1\\Reference.map", ItemType.None);
|
||||
// wsdlFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost1\\test.wsdl", ItemType.None);
|
||||
// proxyFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost1\\Reference.cs", ItemType.Compile);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceRelativePath()
|
||||
// {
|
||||
// Assert.AreEqual("Web References\\localhost1", webReferenceUrl.RelPath);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceName()
|
||||
// {
|
||||
// Assert.AreEqual(name, webReference.Name);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceDirectory()
|
||||
// {
|
||||
// Assert.AreEqual(Path.Combine(project.Directory, "Web References\\localhost1"), webReference.Directory);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ProxyFileName()
|
||||
// {
|
||||
// Assert.AreEqual("C:\\Projects\\Web References\\localhost1\\Reference.cs", webReference.WebProxyFileName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void DiscoFileItemExists()
|
||||
// {
|
||||
// Assert.IsNotNull(discoFileProjectItem);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WsdlFileItemExists()
|
||||
// {
|
||||
// Assert.IsNotNull(wsdlFileProjectItem);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ReferenceMapFileItemExists()
|
||||
// {
|
||||
// Assert.IsNotNull(referenceMapFileProjectItem);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ProxyFileItemExists()
|
||||
// {
|
||||
// Assert.IsNotNull(proxyFileProjectItem);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,67 +1,68 @@
@@ -1,67 +1,68 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop; |
||||
using SD = ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.IO; |
||||
using System.Collections.Generic; |
||||
using System.Web.Services.Description; |
||||
using System.Web.Services.Discovery; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
/// <summary>
|
||||
/// Tests the generated items are not changed if the items have been
|
||||
/// added to the project. Previously a WebReferencesProjectItem would be
|
||||
/// missing after the items have been added to the project.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class WebReferenceProjectItemsCachedTest |
||||
{ |
||||
SD.WebReference webReference; |
||||
DiscoveryClientProtocol protocol; |
||||
WebReferencesProjectItem webReferencesProjectItem; |
||||
MSBuildBasedProject project; |
||||
|
||||
string name = "localhost"; |
||||
string proxyNamespace = "WebReferenceNamespace"; |
||||
string updateFromUrl = "http://localhost/test.asmx"; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
project.FileName = "C:\\projects\\test\\foo.csproj"; |
||||
|
||||
protocol = new DiscoveryClientProtocol(); |
||||
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference(); |
||||
discoveryRef.Url = updateFromUrl; |
||||
protocol.References.Add(discoveryRef); |
||||
|
||||
ContractReference contractRef = new ContractReference(); |
||||
contractRef.Url = "http://localhost/test.asmx?wsdl"; |
||||
contractRef.ClientProtocol = new DiscoveryClientProtocol(); |
||||
ServiceDescription desc = new ServiceDescription(); |
||||
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc); |
||||
protocol.References.Add(contractRef); |
||||
|
||||
WebReferenceTestHelper.InitializeProjectBindings(); |
||||
|
||||
webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol); |
||||
|
||||
foreach (ProjectItem item in webReference.Items) { |
||||
ProjectService.AddProjectItem(project, item); |
||||
} |
||||
webReferencesProjectItem = webReference.WebReferencesProjectItem; |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferencesProjectItemExists() |
||||
{ |
||||
Assert.IsNotNull(webReferencesProjectItem); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop;
|
||||
//using SD = ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Web.Services.Description;
|
||||
//using System.Web.Services.Discovery;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests the generated items are not changed if the items have been
|
||||
// /// added to the project. Previously a WebReferencesProjectItem would be
|
||||
// /// missing after the items have been added to the project.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class WebReferenceProjectItemsCachedTest
|
||||
// {
|
||||
// SD.WebReference webReference;
|
||||
// DiscoveryClientProtocol protocol;
|
||||
// WebReferencesProjectItem webReferencesProjectItem;
|
||||
// MSBuildBasedProject project;
|
||||
//
|
||||
// string name = "localhost";
|
||||
// string proxyNamespace = "WebReferenceNamespace";
|
||||
// string updateFromUrl = "http://localhost/test.asmx";
|
||||
//
|
||||
// [TestFixtureSetUp]
|
||||
// public void SetUpFixture()
|
||||
// {
|
||||
// project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// project.FileName = "C:\\projects\\test\\foo.csproj";
|
||||
//
|
||||
// protocol = new DiscoveryClientProtocol();
|
||||
// DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
|
||||
// discoveryRef.Url = updateFromUrl;
|
||||
// protocol.References.Add(discoveryRef);
|
||||
//
|
||||
// ContractReference contractRef = new ContractReference();
|
||||
// contractRef.Url = "http://localhost/test.asmx?wsdl";
|
||||
// contractRef.ClientProtocol = new DiscoveryClientProtocol();
|
||||
// ServiceDescription desc = new ServiceDescription();
|
||||
// contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
|
||||
// protocol.References.Add(contractRef);
|
||||
//
|
||||
// WebReferenceTestHelper.InitializeProjectBindings();
|
||||
//
|
||||
// webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
|
||||
//
|
||||
// foreach (ProjectItem item in webReference.Items) {
|
||||
// ProjectService.AddProjectItem(project, item);
|
||||
// }
|
||||
// webReferencesProjectItem = webReference.WebReferencesProjectItem;
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferencesProjectItemExists()
|
||||
// {
|
||||
// Assert.IsNotNull(webReferencesProjectItem);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,212 +1,213 @@
@@ -1,212 +1,213 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop; |
||||
using SD = ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.IO; |
||||
using System.Collections.Generic; |
||||
using System.Web.Services.Description; |
||||
using System.Web.Services.Discovery; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
/// <summary>
|
||||
/// Tests the generated project items for a web reference.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class WebReferenceProjectItemsTest |
||||
{ |
||||
SD.WebReference webReference; |
||||
DiscoveryClientProtocol protocol; |
||||
WebReferenceUrl webReferenceUrl; |
||||
FileProjectItem discoFileProjectItem; |
||||
FileProjectItem referenceMapFileProjectItem; |
||||
FileProjectItem wsdlFileProjectItem; |
||||
FileProjectItem proxyFileProjectItem; |
||||
WebReferencesProjectItem webReferencesProjectItem; |
||||
ReferenceProjectItem webServicesReferenceProjectItem; |
||||
MSBuildBasedProject project; |
||||
|
||||
string name = "localhost"; |
||||
string proxyNamespace = "WebReferenceNamespace"; |
||||
string updateFromUrl = "http://localhost/test.asmx"; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
project.FileName = "C:\\projects\\test\\foo.csproj"; |
||||
|
||||
protocol = new DiscoveryClientProtocol(); |
||||
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference(); |
||||
discoveryRef.Url = updateFromUrl; |
||||
protocol.References.Add(discoveryRef); |
||||
|
||||
ContractReference contractRef = new ContractReference(); |
||||
contractRef.Url = "http://localhost/test.asmx?wsdl"; |
||||
contractRef.ClientProtocol = new DiscoveryClientProtocol(); |
||||
ServiceDescription desc = new ServiceDescription(); |
||||
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc); |
||||
protocol.References.Add(contractRef); |
||||
|
||||
WebReferenceTestHelper.InitializeProjectBindings(); |
||||
|
||||
webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol); |
||||
|
||||
webReferenceUrl = webReference.WebReferenceUrl; |
||||
discoFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\test.disco", ItemType.None); |
||||
referenceMapFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.map", ItemType.None); |
||||
wsdlFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\test.wsdl", ItemType.None); |
||||
proxyFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.cs", ItemType.Compile); |
||||
webReferencesProjectItem = (WebReferencesProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, "Web References\\", ItemType.WebReferences); |
||||
webServicesReferenceProjectItem = (ReferenceProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.Reference); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceInProjectItems() |
||||
{ |
||||
Assert.IsNotNull((WebReferenceUrl)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.WebReferenceUrl)); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceInclude() |
||||
{ |
||||
Assert.AreEqual(updateFromUrl, webReferenceUrl.Include); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceHasProject() |
||||
{ |
||||
Assert.IsNotNull(webReferenceUrl.Project); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceHasWebReferencesProjectItem() |
||||
{ |
||||
Assert.IsNotNull(webReference.WebReferencesProjectItem); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferencesDirectory() |
||||
{ |
||||
Assert.AreEqual("C:\\projects\\test\\Web References", webReferencesProjectItem.Directory); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceUpdateFromUrl() |
||||
{ |
||||
Assert.AreEqual(updateFromUrl, webReferenceUrl.UpdateFromURL); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceUrlBehaviour() |
||||
{ |
||||
Assert.AreEqual("Static", webReferenceUrl.UrlBehavior); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceUrlNamespace() |
||||
{ |
||||
Assert.AreEqual(proxyNamespace, webReferenceUrl.Namespace); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceRelPath() |
||||
{ |
||||
Assert.AreEqual("Web References\\localhost", webReferenceUrl.RelPath); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferenceDirectory() |
||||
{ |
||||
Assert.AreEqual("C:\\projects\\test\\Web References\\localhost", webReference.Directory); |
||||
} |
||||
|
||||
[Test] |
||||
public void DiscoFileItemExists() |
||||
{ |
||||
Assert.IsNotNull(discoFileProjectItem); |
||||
} |
||||
|
||||
[Test] |
||||
public void WsdlFileItemHasProject() |
||||
{ |
||||
Assert.IsNotNull(wsdlFileProjectItem.Project); |
||||
} |
||||
|
||||
[Test] |
||||
public void ReferenceMapFileItemGeneratorProperty() |
||||
{ |
||||
Assert.AreEqual("MSDiscoCodeGenerator", referenceMapFileProjectItem.GetEvaluatedMetadata("Generator")); |
||||
} |
||||
|
||||
[Test] |
||||
public void ReferenceMapFileItemLastGenOutputProperty() |
||||
{ |
||||
Assert.AreEqual("Reference.cs", referenceMapFileProjectItem.GetEvaluatedMetadata("LastGenOutput")); |
||||
} |
||||
|
||||
[Test] |
||||
public void ReferenceMapFileItemHasProject() |
||||
{ |
||||
Assert.IsNotNull(referenceMapFileProjectItem.Project); |
||||
} |
||||
|
||||
[Test] |
||||
public void ProxyFileItemAutoGenProperty() |
||||
{ |
||||
Assert.AreEqual("True", proxyFileProjectItem.GetEvaluatedMetadata("AutoGen")); |
||||
} |
||||
|
||||
[Test] |
||||
public void ProxyFileItemDesignTimeProperty() |
||||
{ |
||||
Assert.AreEqual("True", proxyFileProjectItem.GetEvaluatedMetadata("DesignTime")); |
||||
} |
||||
|
||||
[Test] |
||||
public void ProxyFileName() |
||||
{ |
||||
Assert.AreEqual("C:\\projects\\test\\Web References\\localhost\\Reference.cs", webReference.WebProxyFileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void ProxyFileItemDependentUpon() |
||||
{ |
||||
Assert.AreEqual("Reference.map", proxyFileProjectItem.DependentUpon); |
||||
} |
||||
|
||||
[Test] |
||||
public void ProxyFileItemHasProject() |
||||
{ |
||||
Assert.IsNotNull(proxyFileProjectItem.Project); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferencesItemHasProject() |
||||
{ |
||||
Assert.IsNotNull(webReferencesProjectItem.Project); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebServicesReferenceItemHasProject() |
||||
{ |
||||
Assert.IsNotNull(webServicesReferenceProjectItem.Project); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebServicesReferenceItemInclude() |
||||
{ |
||||
Assert.AreEqual("System.Web.Services", webServicesReferenceProjectItem.Include); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebReferencesFolder() |
||||
{ |
||||
Assert.AreEqual("C:\\projects\\test\\Web References", webReference.WebReferencesDirectory); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop;
|
||||
//using SD = ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Web.Services.Description;
|
||||
//using System.Web.Services.Discovery;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests the generated project items for a web reference.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class WebReferenceProjectItemsTest
|
||||
// {
|
||||
// SD.WebReference webReference;
|
||||
// DiscoveryClientProtocol protocol;
|
||||
// WebReferenceUrl webReferenceUrl;
|
||||
// FileProjectItem discoFileProjectItem;
|
||||
// FileProjectItem referenceMapFileProjectItem;
|
||||
// FileProjectItem wsdlFileProjectItem;
|
||||
// FileProjectItem proxyFileProjectItem;
|
||||
// WebReferencesProjectItem webReferencesProjectItem;
|
||||
// ReferenceProjectItem webServicesReferenceProjectItem;
|
||||
// MSBuildBasedProject project;
|
||||
//
|
||||
// string name = "localhost";
|
||||
// string proxyNamespace = "WebReferenceNamespace";
|
||||
// string updateFromUrl = "http://localhost/test.asmx";
|
||||
//
|
||||
// [TestFixtureSetUp]
|
||||
// public void SetUpFixture()
|
||||
// {
|
||||
// project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// project.FileName = "C:\\projects\\test\\foo.csproj";
|
||||
//
|
||||
// protocol = new DiscoveryClientProtocol();
|
||||
// DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
|
||||
// discoveryRef.Url = updateFromUrl;
|
||||
// protocol.References.Add(discoveryRef);
|
||||
//
|
||||
// ContractReference contractRef = new ContractReference();
|
||||
// contractRef.Url = "http://localhost/test.asmx?wsdl";
|
||||
// contractRef.ClientProtocol = new DiscoveryClientProtocol();
|
||||
// ServiceDescription desc = new ServiceDescription();
|
||||
// contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
|
||||
// protocol.References.Add(contractRef);
|
||||
//
|
||||
// WebReferenceTestHelper.InitializeProjectBindings();
|
||||
//
|
||||
// webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
|
||||
//
|
||||
// webReferenceUrl = webReference.WebReferenceUrl;
|
||||
// discoFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\test.disco", ItemType.None);
|
||||
// referenceMapFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.map", ItemType.None);
|
||||
// wsdlFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\test.wsdl", ItemType.None);
|
||||
// proxyFileProjectItem = WebReferenceTestHelper.GetFileProjectItem(webReference.Items, "Web References\\localhost\\Reference.cs", ItemType.Compile);
|
||||
// webReferencesProjectItem = (WebReferencesProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, "Web References\\", ItemType.WebReferences);
|
||||
// webServicesReferenceProjectItem = (ReferenceProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.Reference);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceInProjectItems()
|
||||
// {
|
||||
// Assert.IsNotNull((WebReferenceUrl)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.WebReferenceUrl));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceInclude()
|
||||
// {
|
||||
// Assert.AreEqual(updateFromUrl, webReferenceUrl.Include);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceHasProject()
|
||||
// {
|
||||
// Assert.IsNotNull(webReferenceUrl.Project);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceHasWebReferencesProjectItem()
|
||||
// {
|
||||
// Assert.IsNotNull(webReference.WebReferencesProjectItem);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferencesDirectory()
|
||||
// {
|
||||
// Assert.AreEqual("C:\\projects\\test\\Web References", webReferencesProjectItem.Directory);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceUpdateFromUrl()
|
||||
// {
|
||||
// Assert.AreEqual(updateFromUrl, webReferenceUrl.UpdateFromURL);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceUrlBehaviour()
|
||||
// {
|
||||
// Assert.AreEqual("Static", webReferenceUrl.UrlBehavior);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceUrlNamespace()
|
||||
// {
|
||||
// Assert.AreEqual(proxyNamespace, webReferenceUrl.Namespace);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceRelPath()
|
||||
// {
|
||||
// Assert.AreEqual("Web References\\localhost", webReferenceUrl.RelPath);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferenceDirectory()
|
||||
// {
|
||||
// Assert.AreEqual("C:\\projects\\test\\Web References\\localhost", webReference.Directory);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void DiscoFileItemExists()
|
||||
// {
|
||||
// Assert.IsNotNull(discoFileProjectItem);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WsdlFileItemHasProject()
|
||||
// {
|
||||
// Assert.IsNotNull(wsdlFileProjectItem.Project);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ReferenceMapFileItemGeneratorProperty()
|
||||
// {
|
||||
// Assert.AreEqual("MSDiscoCodeGenerator", referenceMapFileProjectItem.GetEvaluatedMetadata("Generator"));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ReferenceMapFileItemLastGenOutputProperty()
|
||||
// {
|
||||
// Assert.AreEqual("Reference.cs", referenceMapFileProjectItem.GetEvaluatedMetadata("LastGenOutput"));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ReferenceMapFileItemHasProject()
|
||||
// {
|
||||
// Assert.IsNotNull(referenceMapFileProjectItem.Project);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ProxyFileItemAutoGenProperty()
|
||||
// {
|
||||
// Assert.AreEqual("True", proxyFileProjectItem.GetEvaluatedMetadata("AutoGen"));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ProxyFileItemDesignTimeProperty()
|
||||
// {
|
||||
// Assert.AreEqual("True", proxyFileProjectItem.GetEvaluatedMetadata("DesignTime"));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ProxyFileName()
|
||||
// {
|
||||
// Assert.AreEqual("C:\\projects\\test\\Web References\\localhost\\Reference.cs", webReference.WebProxyFileName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ProxyFileItemDependentUpon()
|
||||
// {
|
||||
// Assert.AreEqual("Reference.map", proxyFileProjectItem.DependentUpon);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ProxyFileItemHasProject()
|
||||
// {
|
||||
// Assert.IsNotNull(proxyFileProjectItem.Project);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferencesItemHasProject()
|
||||
// {
|
||||
// Assert.IsNotNull(webReferencesProjectItem.Project);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebServicesReferenceItemHasProject()
|
||||
// {
|
||||
// Assert.IsNotNull(webServicesReferenceProjectItem.Project);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebServicesReferenceItemInclude()
|
||||
// {
|
||||
// Assert.AreEqual("System.Web.Services", webServicesReferenceProjectItem.Include);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebReferencesFolder()
|
||||
// {
|
||||
// Assert.AreEqual("C:\\projects\\test\\Web References", webReference.WebReferencesDirectory);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,131 +1,132 @@
@@ -1,131 +1,132 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop.Internal.Templates; |
||||
using System; |
||||
using System.Collections.Generic; |
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using ICSharpCode.SharpDevelop.Tests.Utils; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
/// <summary>
|
||||
/// Helper methods used when testing web references
|
||||
/// </summary>
|
||||
public static class WebReferenceTestHelper |
||||
{ |
||||
public static MSBuildBasedProject CreateTestProject(string languageName) |
||||
{ |
||||
return new TestProject(languageName); |
||||
} |
||||
|
||||
class TestProject : CompilableProject |
||||
{ |
||||
string languageName; |
||||
bool readOnly = false; |
||||
|
||||
public TestProject(string languageName) |
||||
: base(new ProjectCreateInformation { |
||||
Solution = new Solution(new MockProjectChangeWatcher()), |
||||
ProjectName = "TestProject", |
||||
OutputProjectFileName = "c:\\temp\\TestProject.csproj" |
||||
}) |
||||
{ |
||||
this.languageName = languageName; |
||||
} |
||||
|
||||
public override string Language { |
||||
get { return languageName; } |
||||
} |
||||
|
||||
public override bool ReadOnly { |
||||
get { return readOnly; } |
||||
} |
||||
|
||||
public override ICSharpCode.SharpDevelop.Dom.LanguageProperties LanguageProperties { |
||||
get { return ICSharpCode.SharpDevelop.Dom.LanguageProperties.CSharp; } |
||||
} |
||||
} |
||||
|
||||
public static void InitializeProjectBindings() |
||||
{ |
||||
Properties prop = new Properties(); |
||||
prop["id"] = "C#"; |
||||
prop["supportedextensions"] = ".cs"; |
||||
prop["projectfileextension"] = ".csproj"; |
||||
Codon codon1 = new Codon(null, "ProjectBinding", prop, new Condition[0]); |
||||
prop = new Properties(); |
||||
prop["id"] = "VBNet"; |
||||
prop["supportedextensions"] = ".vb"; |
||||
prop["projectfileextension"] = ".vbproj"; |
||||
Codon codon2 = new Codon(null, "ProjectBinding", prop, new Condition[0]); |
||||
ProjectBindingService.SetBindings(new ProjectBindingDescriptor[] { |
||||
new ProjectBindingDescriptor(codon1), |
||||
new ProjectBindingDescriptor(codon2) |
||||
}); |
||||
} |
||||
|
||||
public static ProjectItem GetProjectItem(List<ProjectItem> items, string include, ItemType itemType) { |
||||
foreach (ProjectItem item in items) { |
||||
if (item.ItemType == itemType) { |
||||
if (item.Include == include) { |
||||
return item; |
||||
} |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public static FileProjectItem GetFileProjectItem(List<ProjectItem> items, string include, ItemType itemType) { |
||||
foreach (ProjectItem item in items) { |
||||
if (item.ItemType == itemType) { |
||||
if (item.Include == include) { |
||||
return (FileProjectItem)item; |
||||
} |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public static ProjectItem GetProjectItem(List<ProjectItem> items, ItemType itemType) |
||||
{ |
||||
foreach (ProjectItem item in items) { |
||||
if (item.ItemType == itemType) { |
||||
return item; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public static WebReferencesFolderNode GetWebReferencesFolderNode(ProjectNode projectNode) |
||||
{ |
||||
foreach (AbstractProjectBrowserTreeNode node in projectNode.Nodes) { |
||||
if (node is WebReferencesFolderNode) { |
||||
return (WebReferencesFolderNode)node; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public static WebReferenceNode GetWebReferenceNode(WebReferencesFolderNode webReferencesFolderNode) { |
||||
foreach (AbstractProjectBrowserTreeNode node in webReferencesFolderNode.Nodes) { |
||||
if (node is WebReferenceNode) { |
||||
return (WebReferenceNode)node; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public static FileNode GetFileNode(AbstractProjectBrowserTreeNode parent, string fileName) |
||||
{ |
||||
foreach (AbstractProjectBrowserTreeNode node in parent.Nodes) { |
||||
FileNode fileNode = node as FileNode; |
||||
if (fileNode != null && fileNode.FileName == fileName) { |
||||
return fileNode; |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop.Internal.Templates;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using ICSharpCode.Core;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using ICSharpCode.SharpDevelop.Tests.Utils;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Helper methods used when testing web references
|
||||
// /// </summary>
|
||||
// public static class WebReferenceTestHelper
|
||||
// {
|
||||
// public static MSBuildBasedProject CreateTestProject(string languageName)
|
||||
// {
|
||||
// return new TestProject(languageName);
|
||||
// }
|
||||
//
|
||||
// class TestProject : CompilableProject
|
||||
// {
|
||||
// string languageName;
|
||||
// bool readOnly = false;
|
||||
//
|
||||
// public TestProject(string languageName)
|
||||
// : base(new ProjectCreateInformation {
|
||||
// Solution = new Solution(new MockProjectChangeWatcher()),
|
||||
// ProjectName = "TestProject",
|
||||
// OutputProjectFileName = "c:\\temp\\TestProject.csproj"
|
||||
// })
|
||||
// {
|
||||
// this.languageName = languageName;
|
||||
// }
|
||||
//
|
||||
// public override string Language {
|
||||
// get { return languageName; }
|
||||
// }
|
||||
//
|
||||
// public override bool ReadOnly {
|
||||
// get { return readOnly; }
|
||||
// }
|
||||
//
|
||||
// public override ICSharpCode.SharpDevelop.Dom.LanguageProperties LanguageProperties {
|
||||
// get { return ICSharpCode.SharpDevelop.Dom.LanguageProperties.CSharp; }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static void InitializeProjectBindings()
|
||||
// {
|
||||
// Properties prop = new Properties();
|
||||
// prop["id"] = "C#";
|
||||
// prop["supportedextensions"] = ".cs";
|
||||
// prop["projectfileextension"] = ".csproj";
|
||||
// Codon codon1 = new Codon(null, "ProjectBinding", prop, new Condition[0]);
|
||||
// prop = new Properties();
|
||||
// prop["id"] = "VBNet";
|
||||
// prop["supportedextensions"] = ".vb";
|
||||
// prop["projectfileextension"] = ".vbproj";
|
||||
// Codon codon2 = new Codon(null, "ProjectBinding", prop, new Condition[0]);
|
||||
// ProjectBindingService.SetBindings(new ProjectBindingDescriptor[] {
|
||||
// new ProjectBindingDescriptor(codon1),
|
||||
// new ProjectBindingDescriptor(codon2)
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// public static ProjectItem GetProjectItem(List<ProjectItem> items, string include, ItemType itemType) {
|
||||
// foreach (ProjectItem item in items) {
|
||||
// if (item.ItemType == itemType) {
|
||||
// if (item.Include == include) {
|
||||
// return item;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public static FileProjectItem GetFileProjectItem(List<ProjectItem> items, string include, ItemType itemType) {
|
||||
// foreach (ProjectItem item in items) {
|
||||
// if (item.ItemType == itemType) {
|
||||
// if (item.Include == include) {
|
||||
// return (FileProjectItem)item;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public static ProjectItem GetProjectItem(List<ProjectItem> items, ItemType itemType)
|
||||
// {
|
||||
// foreach (ProjectItem item in items) {
|
||||
// if (item.ItemType == itemType) {
|
||||
// return item;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public static WebReferencesFolderNode GetWebReferencesFolderNode(ProjectNode projectNode)
|
||||
// {
|
||||
// foreach (AbstractProjectBrowserTreeNode node in projectNode.Nodes) {
|
||||
// if (node is WebReferencesFolderNode) {
|
||||
// return (WebReferencesFolderNode)node;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public static WebReferenceNode GetWebReferenceNode(WebReferencesFolderNode webReferencesFolderNode) {
|
||||
// foreach (AbstractProjectBrowserTreeNode node in webReferencesFolderNode.Nodes) {
|
||||
// if (node is WebReferenceNode) {
|
||||
// return (WebReferenceNode)node;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public static FileNode GetFileNode(AbstractProjectBrowserTreeNode parent, string fileName)
|
||||
// {
|
||||
// foreach (AbstractProjectBrowserTreeNode node in parent.Nodes) {
|
||||
// FileNode fileNode = node as FileNode;
|
||||
// if (fileNode != null && fileNode.FileName == fileName) {
|
||||
// return fileNode;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,77 +1,78 @@
@@ -1,77 +1,78 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.IO; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
[TestFixture] |
||||
public class WebReferenceUrlTests |
||||
{ |
||||
[Test] |
||||
public void FileName() |
||||
{ |
||||
MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
project.FileName = "c:\\projects\\test\\foo.csproj"; |
||||
WebReferenceUrl url = new WebReferenceUrl(project); |
||||
url.RelPath = "Web References\\localhost"; |
||||
url.Include = "http://localhost/test.asmx"; |
||||
|
||||
Assert.AreEqual(Path.Combine(project.Directory, url.RelPath), url.FileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void RelPathEndsWithSlash() |
||||
{ |
||||
MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
project.FileName = "c:\\projects\\test\\foo.csproj"; |
||||
WebReferenceUrl url = new WebReferenceUrl(project); |
||||
url.RelPath = "Web References\\localhost\\"; |
||||
url.Include = "http://localhost/test.asmx"; |
||||
|
||||
Assert.AreEqual(Path.Combine(project.Directory, url.RelPath.Trim('\\')), url.FileName); |
||||
} |
||||
|
||||
[Test] |
||||
public void ChangeFileName() |
||||
{ |
||||
MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
project.FileName = "c:\\projects\\test\\foo.csproj"; |
||||
WebReferenceUrl url = new WebReferenceUrl(project); |
||||
url.RelPath = "Web References\\localhost"; |
||||
url.Include = "http://localhost/test.asmx"; |
||||
|
||||
// Change filename - simulate a folder rename.
|
||||
url.FileName = "c:\\projects\\test\\Web References\\mywebservice"; |
||||
|
||||
Assert.AreEqual("http://localhost/test.asmx", url.Include); |
||||
Assert.AreEqual("Web References\\mywebservice", url.RelPath); |
||||
} |
||||
|
||||
[Test] |
||||
public void NoNamespaceSpecified() |
||||
{ |
||||
MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
project.FileName = "c:\\projects\\test\\foo.csproj"; |
||||
project.RootNamespace = "TestRootNamespace"; |
||||
WebReferenceUrl url = new WebReferenceUrl(project); |
||||
|
||||
Assert.AreEqual("TestRootNamespace", url.Namespace); |
||||
} |
||||
|
||||
[Test] |
||||
public void NamespaceSpecified() |
||||
{ |
||||
MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
project.FileName = "c:\\projects\\test\\foo.csproj"; |
||||
project.RootNamespace = "TestRootNamespace"; |
||||
WebReferenceUrl url = new WebReferenceUrl(project); |
||||
url.Namespace = "WebReferenceNamespace"; |
||||
|
||||
Assert.AreEqual("WebReferenceNamespace", url.Namespace); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// [TestFixture]
|
||||
// public class WebReferenceUrlTests
|
||||
// {
|
||||
// [Test]
|
||||
// public void FileName()
|
||||
// {
|
||||
// MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// project.FileName = "c:\\projects\\test\\foo.csproj";
|
||||
// WebReferenceUrl url = new WebReferenceUrl(project);
|
||||
// url.RelPath = "Web References\\localhost";
|
||||
// url.Include = "http://localhost/test.asmx";
|
||||
//
|
||||
// Assert.AreEqual(Path.Combine(project.Directory, url.RelPath), url.FileName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void RelPathEndsWithSlash()
|
||||
// {
|
||||
// MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// project.FileName = "c:\\projects\\test\\foo.csproj";
|
||||
// WebReferenceUrl url = new WebReferenceUrl(project);
|
||||
// url.RelPath = "Web References\\localhost\\";
|
||||
// url.Include = "http://localhost/test.asmx";
|
||||
//
|
||||
// Assert.AreEqual(Path.Combine(project.Directory, url.RelPath.Trim('\\')), url.FileName);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void ChangeFileName()
|
||||
// {
|
||||
// MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// project.FileName = "c:\\projects\\test\\foo.csproj";
|
||||
// WebReferenceUrl url = new WebReferenceUrl(project);
|
||||
// url.RelPath = "Web References\\localhost";
|
||||
// url.Include = "http://localhost/test.asmx";
|
||||
//
|
||||
// // Change filename - simulate a folder rename.
|
||||
// url.FileName = "c:\\projects\\test\\Web References\\mywebservice";
|
||||
//
|
||||
// Assert.AreEqual("http://localhost/test.asmx", url.Include);
|
||||
// Assert.AreEqual("Web References\\mywebservice", url.RelPath);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void NoNamespaceSpecified()
|
||||
// {
|
||||
// MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// project.FileName = "c:\\projects\\test\\foo.csproj";
|
||||
// project.RootNamespace = "TestRootNamespace";
|
||||
// WebReferenceUrl url = new WebReferenceUrl(project);
|
||||
//
|
||||
// Assert.AreEqual("TestRootNamespace", url.Namespace);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void NamespaceSpecified()
|
||||
// {
|
||||
// MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// project.FileName = "c:\\projects\\test\\foo.csproj";
|
||||
// project.RootNamespace = "TestRootNamespace";
|
||||
// WebReferenceUrl url = new WebReferenceUrl(project);
|
||||
// url.Namespace = "WebReferenceNamespace";
|
||||
//
|
||||
// Assert.AreEqual("WebReferenceNamespace", url.Namespace);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@ -1,95 +1,96 @@
@@ -1,95 +1,96 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using ICSharpCode.SharpDevelop; |
||||
using SD = ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using NUnit.Framework; |
||||
using System; |
||||
using System.IO; |
||||
using System.Collections.Generic; |
||||
using System.Web.Services.Description; |
||||
using System.Web.Services.Discovery; |
||||
|
||||
namespace ICSharpCode.SharpDevelop.Tests.WebReferences |
||||
{ |
||||
/// <summary>
|
||||
/// Tests that the generated project items for a web reference do not include
|
||||
/// a reference to System.Web.Services if one already exists in the project.
|
||||
/// </summary>
|
||||
[TestFixture] |
||||
public class WebServicesReferenceExistsTest |
||||
{ |
||||
SD.WebReference webReference; |
||||
DiscoveryClientProtocol protocol; |
||||
ReferenceProjectItem webServicesReferenceProjectItem; |
||||
MSBuildBasedProject project; |
||||
|
||||
string name = "localhost"; |
||||
string proxyNamespace = "WebReferenceNamespace"; |
||||
string updateFromUrl = "http://localhost/test.asmx"; |
||||
|
||||
[TestFixtureSetUp] |
||||
public void SetUpFixture() |
||||
{ |
||||
project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
project.FileName = "C:\\projects\\test\\foo.csproj"; |
||||
|
||||
ReferenceProjectItem referenceItem = new ReferenceProjectItem(project, "System.Web.Services"); |
||||
ProjectService.AddProjectItem(project, referenceItem); |
||||
|
||||
protocol = new DiscoveryClientProtocol(); |
||||
DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference(); |
||||
discoveryRef.Url = updateFromUrl; |
||||
protocol.References.Add(discoveryRef); |
||||
|
||||
ContractReference contractRef = new ContractReference(); |
||||
contractRef.Url = "http://localhost/test.asmx?wsdl"; |
||||
contractRef.ClientProtocol = new DiscoveryClientProtocol(); |
||||
ServiceDescription desc = new ServiceDescription(); |
||||
contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc); |
||||
protocol.References.Add(contractRef); |
||||
|
||||
WebReferenceTestHelper.InitializeProjectBindings(); |
||||
|
||||
webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol); |
||||
webServicesReferenceProjectItem = (ReferenceProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.Reference); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebServicesReferenceItemDoesNotExist() |
||||
{ |
||||
Assert.IsNull(webServicesReferenceProjectItem); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebServicesReferenceDoesNotExist1() |
||||
{ |
||||
MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
ReferenceProjectItem referenceItem = new ReferenceProjectItem(project, "System.Windows.Forms"); |
||||
ProjectService.AddProjectItem(project, referenceItem); |
||||
|
||||
Assert.IsFalse(SD.WebReference.ProjectContainsWebServicesReference(project)); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebServicesReferenceExists1() |
||||
{ |
||||
MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
ReferenceProjectItem referenceItem = new ReferenceProjectItem(project, "system.web.services"); |
||||
ProjectService.AddProjectItem(project, referenceItem); |
||||
|
||||
Assert.IsTrue(SD.WebReference.ProjectContainsWebServicesReference(project)); |
||||
} |
||||
|
||||
[Test] |
||||
public void WebServicesReferenceExists2() |
||||
{ |
||||
MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#"); |
||||
ReferenceProjectItem referenceItem = new ReferenceProjectItem(project, "System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"); |
||||
ProjectService.AddProjectItem(project, referenceItem); |
||||
|
||||
Assert.IsTrue(SD.WebReference.ProjectContainsWebServicesReference(project)); |
||||
} |
||||
} |
||||
} |
||||
#warning
|
||||
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
//
|
||||
//using ICSharpCode.SharpDevelop;
|
||||
//using SD = ICSharpCode.SharpDevelop.Gui;
|
||||
//using ICSharpCode.SharpDevelop.Project;
|
||||
//using NUnit.Framework;
|
||||
//using System;
|
||||
//using System.IO;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Web.Services.Description;
|
||||
//using System.Web.Services.Discovery;
|
||||
//
|
||||
//namespace ICSharpCode.SharpDevelop.Tests.WebReferences
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// Tests that the generated project items for a web reference do not include
|
||||
// /// a reference to System.Web.Services if one already exists in the project.
|
||||
// /// </summary>
|
||||
// [TestFixture]
|
||||
// public class WebServicesReferenceExistsTest
|
||||
// {
|
||||
// SD.WebReference webReference;
|
||||
// DiscoveryClientProtocol protocol;
|
||||
// ReferenceProjectItem webServicesReferenceProjectItem;
|
||||
// MSBuildBasedProject project;
|
||||
//
|
||||
// string name = "localhost";
|
||||
// string proxyNamespace = "WebReferenceNamespace";
|
||||
// string updateFromUrl = "http://localhost/test.asmx";
|
||||
//
|
||||
// [TestFixtureSetUp]
|
||||
// public void SetUpFixture()
|
||||
// {
|
||||
// project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// project.FileName = "C:\\projects\\test\\foo.csproj";
|
||||
//
|
||||
// ReferenceProjectItem referenceItem = new ReferenceProjectItem(project, "System.Web.Services");
|
||||
// ProjectService.AddProjectItem(project, referenceItem);
|
||||
//
|
||||
// protocol = new DiscoveryClientProtocol();
|
||||
// DiscoveryDocumentReference discoveryRef = new DiscoveryDocumentReference();
|
||||
// discoveryRef.Url = updateFromUrl;
|
||||
// protocol.References.Add(discoveryRef);
|
||||
//
|
||||
// ContractReference contractRef = new ContractReference();
|
||||
// contractRef.Url = "http://localhost/test.asmx?wsdl";
|
||||
// contractRef.ClientProtocol = new DiscoveryClientProtocol();
|
||||
// ServiceDescription desc = new ServiceDescription();
|
||||
// contractRef.ClientProtocol.Documents.Add(contractRef.Url, desc);
|
||||
// protocol.References.Add(contractRef);
|
||||
//
|
||||
// WebReferenceTestHelper.InitializeProjectBindings();
|
||||
//
|
||||
// webReference = new SD.WebReference(project, updateFromUrl, name, proxyNamespace, protocol);
|
||||
// webServicesReferenceProjectItem = (ReferenceProjectItem)WebReferenceTestHelper.GetProjectItem(webReference.Items, ItemType.Reference);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebServicesReferenceItemDoesNotExist()
|
||||
// {
|
||||
// Assert.IsNull(webServicesReferenceProjectItem);
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebServicesReferenceDoesNotExist1()
|
||||
// {
|
||||
// MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// ReferenceProjectItem referenceItem = new ReferenceProjectItem(project, "System.Windows.Forms");
|
||||
// ProjectService.AddProjectItem(project, referenceItem);
|
||||
//
|
||||
// Assert.IsFalse(SD.WebReference.ProjectContainsWebServicesReference(project));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebServicesReferenceExists1()
|
||||
// {
|
||||
// MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// ReferenceProjectItem referenceItem = new ReferenceProjectItem(project, "system.web.services");
|
||||
// ProjectService.AddProjectItem(project, referenceItem);
|
||||
//
|
||||
// Assert.IsTrue(SD.WebReference.ProjectContainsWebServicesReference(project));
|
||||
// }
|
||||
//
|
||||
// [Test]
|
||||
// public void WebServicesReferenceExists2()
|
||||
// {
|
||||
// MSBuildBasedProject project = WebReferenceTestHelper.CreateTestProject("C#");
|
||||
// ReferenceProjectItem referenceItem = new ReferenceProjectItem(project, "System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
|
||||
// ProjectService.AddProjectItem(project, referenceItem);
|
||||
//
|
||||
// Assert.IsTrue(SD.WebReference.ProjectContainsWebServicesReference(project));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
Loading…
Reference in new issue