[svn] r6711: vs-plugin/trunk/Nemerle.VsIntegration.Tests:
Nemerle.VsIntegration.Tests.csproj Properties/Se...
Nuald
svnadmin at nemerle.org
Tue Sep 26 03:10:20 CEST 2006
Log:
Fix NUnit tests for Nemerle.VsIntegration.Tests project.
Author: Nuald
Date: Tue Sep 26 03:08:45 2006
New Revision: 6711
Added:
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Properties/Settings.Designer.cs
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Properties/Settings.settings
vs-plugin/trunk/Nemerle.VsIntegration.Tests/app.config
vs-plugin/trunk/Nemerle.VsIntegration.Tests/key.snk (contents, props changed)
Modified:
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Nemerle.VsIntegration.Tests.csproj
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/CodeDomParser.cs
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/ParseHelper.cs
vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/Tests/TestEnum.cs
Modified: vs-plugin/trunk/Nemerle.VsIntegration.Tests/Nemerle.VsIntegration.Tests.csproj
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration.Tests/Nemerle.VsIntegration.Tests.csproj (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration.Tests/Nemerle.VsIntegration.Tests.csproj Tue Sep 26 03:08:45 2006
@@ -1,6 +1,8 @@
ďťż<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Nemerle Condition=" '$(Nemerle)' == '' ">$(ProgramFiles)\Nemerle</Nemerle>
+ <SignAssembly>true</SignAssembly>
+ <AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -21,6 +23,8 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <RunCodeAnalysis>false</RunCodeAnalysis>
+ <CodeAnalysisRules>-Microsoft.Design#CA1020;-Microsoft.Naming#CA1706;-Microsoft.Performance#CA1822</CodeAnalysisRules>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -39,6 +43,11 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ <DependentUpon>Settings.settings</DependentUpon>
+ </Compile>
<Compile Include="Utils\CodeDomParser.cs" />
<Compile Include="Utils\ParseHelper.cs" />
<Compile Include="Utils\Tests\TestEnum.cs" />
@@ -70,6 +79,14 @@
<ItemGroup>
<Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ <None Include="key.snk" />
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Added: vs-plugin/trunk/Nemerle.VsIntegration.Tests/Properties/Settings.Designer.cs
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration.Tests/Properties/Settings.Designer.cs Tue Sep 26 03:08:45 2006
@@ -0,0 +1,170 @@
+ďťż//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.112
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Nemerle.VsIntegration.Tests.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Wrong number of base types for {0} class.")]
+ public string WrongNumberBaseTypes {
+ get {
+ return ((string)(this["WrongNumberBaseTypes"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Wrong number of members in {0} class.")]
+ public string WrongNumberMembers {
+ get {
+ return ((string)(this["WrongNumberMembers"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Invalid access modifier for {0}.")]
+ public string InvalidAccessModifier {
+ get {
+ return ((string)(this["InvalidAccessModifier"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Invalid base type for {0} class.")]
+ public string InvalidBaseType {
+ get {
+ return ((string)(this["InvalidBaseType"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Invalid name.")]
+ public string InvalidName {
+ get {
+ return ((string)(this["InvalidName"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("{0} is not a class.")]
+ public string IsNotClass {
+ get {
+ return ((string)(this["IsNotClass"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Wrong number of namespaces.")]
+ public string WrongNumberWorkspaces {
+ get {
+ return ((string)(this["WrongNumberWorkspaces"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Compile unit is empty.")]
+ public string CompileUnitEmpty {
+ get {
+ return ((string)(this["CompileUnitEmpty"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Invalid parameters count in {0} method.")]
+ public string InvalidParametersCount {
+ get {
+ return ((string)(this["InvalidParametersCount"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Invalid type for {0}.")]
+ public string InvalidType {
+ get {
+ return ((string)(this["InvalidType"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Invalid return type for {0} method.")]
+ public string InvalidReturnType {
+ get {
+ return ((string)(this["InvalidReturnType"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Wrong number of types for {0} namespace.")]
+ public string WrongNumberTypes {
+ get {
+ return ((string)(this["WrongNumberTypes"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Wrong number of usings for {0} namespace.")]
+ public string WrongNumberUsings {
+ get {
+ return ((string)(this["WrongNumberUsings"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Invalid namespace.")]
+ public string InvalidNamespace {
+ get {
+ return ((string)(this["InvalidNamespace"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Invalid using for {0}.")]
+ public string InvalidUsing {
+ get {
+ return ((string)(this["InvalidUsing"]));
+ }
+ }
+
+ [global::System.Configuration.ApplicationScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("Did not find code stream for {0}.")]
+ public string NotFoundCodeStream {
+ get {
+ return ((string)(this["NotFoundCodeStream"]));
+ }
+ }
+ }
+}
Added: vs-plugin/trunk/Nemerle.VsIntegration.Tests/Properties/Settings.settings
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration.Tests/Properties/Settings.settings Tue Sep 26 03:08:45 2006
@@ -0,0 +1,54 @@
+ďťż<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Nemerle.VsIntegration.Tests.Properties" GeneratedClassName="Settings">
+ <Profiles />
+ <Settings>
+ <Setting Name="WrongNumberBaseTypes" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Wrong number of base types for {0} class.</Value>
+ </Setting>
+ <Setting Name="WrongNumberMembers" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Wrong number of members in {0} class.</Value>
+ </Setting>
+ <Setting Name="InvalidAccessModifier" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Invalid access modifier for {0}.</Value>
+ </Setting>
+ <Setting Name="InvalidBaseType" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Invalid base type for {0} class.</Value>
+ </Setting>
+ <Setting Name="InvalidName" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Invalid name.</Value>
+ </Setting>
+ <Setting Name="IsNotClass" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">{0} is not a class.</Value>
+ </Setting>
+ <Setting Name="WrongNumberWorkspaces" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Wrong number of namespaces.</Value>
+ </Setting>
+ <Setting Name="CompileUnitEmpty" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Compile unit is empty.</Value>
+ </Setting>
+ <Setting Name="InvalidParametersCount" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Invalid parameters count in {0} method.</Value>
+ </Setting>
+ <Setting Name="InvalidType" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Invalid type for {0}.</Value>
+ </Setting>
+ <Setting Name="InvalidReturnType" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Invalid return type for {0} method.</Value>
+ </Setting>
+ <Setting Name="WrongNumberTypes" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Wrong number of types for {0} namespace.</Value>
+ </Setting>
+ <Setting Name="WrongNumberUsings" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Wrong number of usings for {0} namespace.</Value>
+ </Setting>
+ <Setting Name="InvalidNamespace" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Invalid namespace.</Value>
+ </Setting>
+ <Setting Name="InvalidUsing" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Invalid using for {0}.</Value>
+ </Setting>
+ <Setting Name="NotFoundCodeStream" Type="System.String" Scope="Application">
+ <Value Profile="(Default)">Did not find code stream for {0}.</Value>
+ </Setting>
+ </Settings>
+</SettingsFile>
\ No newline at end of file
Modified: vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/CodeDomParser.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/CodeDomParser.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/CodeDomParser.cs Tue Sep 26 03:08:45 2006
@@ -4,19 +4,22 @@
using Nemerle.Compiler;
using Nemerle.Completion2;
using NUnit.Framework;
+using Nemerle.VsIntegration.Tests.Utils;
using Nemerle.VsIntegration.Tests.Utils.Tests;
-namespace Nemerle.VsIntegration.Tests.Utils
+[assembly: CLSCompliant(true)]
+
+namespace Nemerle.VsIntegration.Tests
{
[TestFixture]
public class CodeDomParser
{
- [TestFixtureSetUp]
+ [SetUp]
public void SetUp()
{
Engine engine = new Engine(null);
- // áĺç ýňîé ńňđîęč âŕëčňń˙ exception â Location.Init()
+ // Without this line we got an exception in the Location.Init() method.
ManagerClass.Instance = engine;
engine.Init();
@@ -37,8 +40,8 @@
ParseHelper.CheckClass(type, "Form1", MemberAttributes.Public, 3, "System.Windows.Forms.Form");
ParseHelper.CheckField(type.Members[0], "components", "System.ComponentModel.IContainer", MemberAttributes.Private);
- ParseHelper.CheckCtor(type.Members[1], MemberAttributes.Public, 1);
- ParseHelper.CheckMethod(type.Members[2], "InitializeComponent", "System.Void", MemberAttributes.Private, 5);
+ ParseHelper.CheckCtor(type.Members[1], MemberAttributes.Public, 0);
+ ParseHelper.CheckMethod(type.Members[2], "InitializeComponent", "System.Void", MemberAttributes.Private, 0);
// prints code
ParseHelper.Provider.GenerateCodeFromCompileUnit(compileUnit, Console.Out, ParseHelper.DefaultOptions);
@@ -59,8 +62,8 @@
ParseHelper.CheckClass(type, "Form2", MemberAttributes.Public, 3, "System.Windows.Forms.Form");
ParseHelper.CheckField(type.Members[0], "components", "System.ComponentModel.IContainer", MemberAttributes.Private);
- ParseHelper.CheckCtor(type.Members[1], MemberAttributes.Public, 1);
- ParseHelper.CheckMethod(type.Members[2], "InitializeComponent", "System.Void", MemberAttributes.Private, 6);
+ ParseHelper.CheckCtor(type.Members[1], MemberAttributes.Public, 0);
+ ParseHelper.CheckMethod(type.Members[2], "InitializeComponent", "System.Void", MemberAttributes.Private, 0);
// prints code
ParseHelper.Provider.GenerateCodeFromCompileUnit(compileUnit, Console.Out, ParseHelper.DefaultOptions);
@@ -83,8 +86,8 @@
ParseHelper.CheckField(type.Members[0], "button1", "System.Windows.Forms.Button", MemberAttributes.FamilyOrAssembly);
ParseHelper.CheckField(type.Members[1], "errorProvider1", "System.Windows.Forms.ErrorProvider", MemberAttributes.Family);
ParseHelper.CheckField(type.Members[2], "components", "System.ComponentModel.IContainer", MemberAttributes.Public);
- ParseHelper.CheckCtor(type.Members[3], MemberAttributes.Public, 1);
- ParseHelper.CheckMethod(type.Members[4], "InitializeComponent", "System.Void", MemberAttributes.Private, 20);
+ ParseHelper.CheckCtor(type.Members[3], MemberAttributes.Public, 0);
+ ParseHelper.CheckMethod(type.Members[4], "InitializeComponent", "System.Void", MemberAttributes.Private, 0);
// prints code
ParseHelper.Provider.GenerateCodeFromCompileUnit(compileUnit, Console.Out, ParseHelper.DefaultOptions);
@@ -107,8 +110,8 @@
ParseHelper.CheckField(type.Members[0], "comboBox1", "System.Windows.Forms.ComboBox", MemberAttributes.Private);
ParseHelper.CheckField(type.Members[1], "treeView1", "System.Windows.Forms.TreeView", MemberAttributes.Private);
ParseHelper.CheckField(type.Members[2], "components", "System.ComponentModel.IContainer", MemberAttributes.Private);
- ParseHelper.CheckCtor(type.Members[3], MemberAttributes.Public, 1);
- ParseHelper.CheckMethod(type.Members[4], "InitializeComponent", "System.Void", MemberAttributes.Private, 29);
+ ParseHelper.CheckCtor(type.Members[3], MemberAttributes.Public, 0);
+ ParseHelper.CheckMethod(type.Members[4], "InitializeComponent", "System.Void", MemberAttributes.Private, 0);
// prints code
ParseHelper.Provider.GenerateCodeFromCompileUnit(compileUnit, Console.Out, ParseHelper.DefaultOptions);
@@ -129,9 +132,9 @@
ParseHelper.CheckClass(type, "Form5", MemberAttributes.Public, 5, "System.Windows.Forms.Form");
ParseHelper.CheckField(type.Members[0], "button1", "System.Windows.Forms.Button", MemberAttributes.Private);
- ParseHelper.CheckCtor(type.Members[1], MemberAttributes.Public, 1);
- ParseHelper.CheckMethod(type.Members[2], "InitializeComponent", "System.Void", MemberAttributes.Private, 14);
- ParseHelper.CheckMethod(type.Members[3], "Form5_Load", "System.Void", MemberAttributes.Private, 1);
+ ParseHelper.CheckCtor(type.Members[1], MemberAttributes.Public, 0);
+ ParseHelper.CheckMethod(type.Members[2], "InitializeComponent", "System.Void", MemberAttributes.Private, 0);
+ ParseHelper.CheckMethod(type.Members[3], "Form5_Load", "System.Void", MemberAttributes.Private, 2);
ParseHelper.CheckMethod(type.Members[4], "button1_Click", "System.Void", MemberAttributes.Private, 2);
// prints code
Modified: vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/ParseHelper.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/ParseHelper.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/ParseHelper.cs Tue Sep 26 03:08:45 2006
@@ -4,12 +4,14 @@
using System.IO;
using NUnit.Framework;
-using Nemerle.VsIntegration.Tests.Utils.Tests;
using Nemerle.Compiler.Utils;
+using Nemerle.VsIntegration.Tests.Properties;
+using Nemerle.VsIntegration.Tests.Utils.Tests;
+using System.Globalization;
namespace Nemerle.VsIntegration.Tests.Utils
{
- internal class ParseHelper
+ internal static class ParseHelper
{
/// <summary>
/// Gets the default options for code generator.
@@ -59,33 +61,12 @@
string testName = test.ToString() + ".n";
Stream codeStream = typeof (ParseHelper).Assembly.GetManifestResourceStream(test.GetType(), testName);
- Assert.IsNotNull(codeStream, "not found codeStream for " + testName);
+ Assert.IsNotNull(codeStream,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.NotFoundCodeStream, testName));
return codeStream;
}
/// <summary>
- /// Gets the code.
- /// </summary>
- /// <param name="test">The test.</param>
- /// <returns></returns>
- public static string GetCode(TestEnum test)
- {
- using (StreamReader rd = new StreamReader(GetCodeStream(test)))
- return rd.ReadToEnd();
- }
-
- /// <summary>
- /// Parses the specified code.
- /// </summary>
- /// <param name="code">The code.</param>
- /// <returns></returns>
- public static CodeCompileUnit Parse(string code)
- {
- using (StringReader reader = new StringReader(code))
- return Parse(reader);
- }
-
- /// <summary>
/// Parses the specified code.
/// </summary>
/// <param name="code">The code.</param>
@@ -106,19 +87,26 @@
/// <param name="usings">The namespace usings.</param>
public static void CheckNamespace(CodeNamespace codeNamespace, string name, int types, params string[] usings)
{
- Assert.AreEqual(name, codeNamespace.Name, "Íĺďđŕâčëüíîĺ čě˙ Namespace.");
+ Assert.AreEqual(name, codeNamespace.Name, Settings.Default.InvalidNamespace);
- Assert.AreEqual(types, codeNamespace.Types.Count, "Íĺâđíîĺ ęîëč÷ĺńňâî ňčďîâ äë˙ " + name);
+ Assert.AreEqual(types, codeNamespace.Types.Count,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.WrongNumberTypes, name));
if (usings != null)
{
- Assert.AreEqual(usings.Length, codeNamespace.Imports.Count, "Íĺâđíîĺ ęîëč÷ĺńňâî usings äë˙ " + name);
+ Assert.AreEqual(usings.Length, codeNamespace.Imports.Count,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.WrongNumberUsings, name));
for (int i = 0; i < usings.Length; i++)
- Assert.AreEqual(usings[i], codeNamespace.Imports[i].Namespace, "Íĺďđŕâčëüíűé using äë˙ " + name);
+ {
+ Assert.AreEqual(usings[i], codeNamespace.Imports[i].Namespace,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.InvalidUsing, name));
+ }
}
else
- Assert.AreEqual(0, codeNamespace.Imports.Count, "Íĺâđíîĺ ęîëč÷ĺńňâî usings äë˙ " + name);
+ {
+ Assert.AreEqual(0, codeNamespace.Imports.Count, "Wrong number of usings for " + name);
+ }
}
/// <summary>
@@ -131,21 +119,30 @@
/// <param name="baseTypes">The class base types.</param>
public static void CheckClass(CodeTypeDeclaration codeType, string name, MemberAttributes modifiers, int members, params string[] baseTypes)
{
- Assert.IsTrue(codeType.IsClass, String.Format("{0} íĺ ęëŕńń.", codeType.Name));
- Assert.AreEqual(name, codeType.Name, "Íĺâĺđíîĺ čě˙ ęëŕńńŕ.");
- Assert.AreEqual(modifiers, codeType.Attributes, "Íĺâĺđíűé ěîäčôčęŕňîđ äîńňóďŕ äë˙ " + name);
+ Assert.IsTrue(codeType.IsClass,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.IsNotClass, codeType.Name));
+ Assert.AreEqual(name, codeType.Name, Settings.Default.InvalidName);
+ Assert.AreEqual(modifiers, codeType.Attributes,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.InvalidAccessModifier, name));
if (baseTypes != null)
{
- Assert.AreEqual(baseTypes.Length, codeType.BaseTypes.Count, "Íĺâđíîĺ ęîëč÷ĺńňâî áŕçîâűé ňčďîâ äë˙ " + name);
+ Assert.AreEqual(baseTypes.Length, codeType.BaseTypes.Count,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.WrongNumberBaseTypes, name));
for (int i = 0; i < baseTypes.Length; i++)
- Assert.AreEqual(baseTypes[i], codeType.BaseTypes[i].BaseType, "Íĺâĺđíűé áŕçîâűé ňčď äë˙ " + name);
+ {
+ Assert.AreEqual(baseTypes[i], codeType.BaseTypes[i].BaseType,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.InvalidBaseType, name));
+ }
}
else
- Assert.AreEqual(0, codeType.BaseTypes.Count, "Íĺâđíîĺ ęîëč÷ĺńňâî áŕçîâűé ňčďîâ äë˙ " + name);
-
+ {
+ Assert.AreEqual(0, codeType.BaseTypes.Count,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.WrongNumberBaseTypes, name));
+ }
- Assert.AreEqual(members, codeType.Members.Count, "Íĺâĺđíîĺ ęîëč÷ĺńňîâ ýëĺěĺíňîâ â ęëŕńńĺ " + name);
+ Assert.AreEqual(members, codeType.Members.Count,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.WrongNumberMembers, name));
}
/// <summary>
@@ -155,15 +152,19 @@
/// <param name="name">The method name.</param>
/// <param name="returnType">The method return type.</param>
/// <param name="modifiers">The method modifiers.</param>
- /// <param name="statements">The count of statements in the <paramref name="member"/>.</param>
+ /// <param name="statements">The count of parameters in the <paramref name="member"/>.</param>
public static void CheckMethod(CodeTypeMember member, string name, string returnType, MemberAttributes modifiers, int statements)
{
CodeMemberMethod method = member as CodeMemberMethod;
- Assert.IsNotNull(method, String.Format("{0} íĺ method.", member.Name));
- Assert.AreEqual(name, method.Name, "Íĺâĺđíîĺ čě˙.");
- Assert.AreEqual(returnType, method.ReturnType.BaseType, "Íĺâĺđíűé âîçâđŕůŕĺěűé ňčď äë˙ " + name);
- Assert.AreEqual(modifiers, method.Attributes, "Íĺâĺđíűé ěîäčôčęŕňîđ äîńňóďŕ äë˙ " + name);
- Assert.AreEqual(statements, method.Statements.Count, "Íĺâĺđíűé ęîëč÷ĺńňâî statements äë˙ " + name);
+ Assert.IsNotNull(method,
+ String.Format(CultureInfo.CurrentCulture, "{0} is not a method.", member.Name));
+ Assert.AreEqual(name, method.Name, Settings.Default.InvalidName);
+ Assert.AreEqual(returnType, method.ReturnType.BaseType,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.InvalidReturnType, name));
+ Assert.AreEqual(modifiers, method.Attributes,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.InvalidAccessModifier, name));
+ Assert.AreEqual(statements, method.Parameters.Count,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.InvalidParametersCount, name));
}
/// <summary>
@@ -171,14 +172,17 @@
/// </summary>
/// <param name="member">The code constructor.</param>
/// <param name="modifiers">The constructor modifiers.</param>
- /// <param name="statements">The count of statements in the <paramref name="member"/>.</param>
+ /// <param name="statements">The count of parameters in the <paramref name="member"/>.</param>
public static void CheckCtor(CodeTypeMember member, MemberAttributes modifiers, int statements)
{
CodeConstructor ctor = member as CodeConstructor;
- Assert.IsNotNull(ctor, String.Format("{0} íĺ constructor.", member.Name));
- Assert.AreEqual(".ctor", ctor.Name, "Íĺâĺđíîĺ čě˙.");
- Assert.AreEqual(modifiers, ctor.Attributes, "Íĺâĺđíűé ěîäčôčęŕňîđ äîńňóďŕ äë˙ " + ctor.Name);
- Assert.AreEqual(statements, ctor.Statements.Count, "Íĺâĺđíűé ęîëč÷ĺńňâî statements äë˙ " + ctor.Name);
+ Assert.IsNotNull(ctor,
+ String.Format(CultureInfo.CurrentCulture, "{0} is not a constructor.", member.Name));
+ Assert.AreEqual(".ctor", ctor.Name, Settings.Default.InvalidName);
+ Assert.AreEqual(modifiers, ctor.Attributes,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.InvalidAccessModifier, ctor.Name));
+ Assert.AreEqual(statements, ctor.Parameters.Count,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.InvalidParametersCount, ctor.Name));
}
/// <summary>
@@ -191,10 +195,13 @@
public static void CheckField(CodeTypeMember member, string name, string type, MemberAttributes modifiers)
{
CodeMemberField field = member as CodeMemberField;
- Assert.IsNotNull(field, String.Format("{0} íĺ field.", member.Name));
- Assert.AreEqual(name, field.Name, "Íĺâĺđíîĺ čě˙ ďîë˙.");
- Assert.AreEqual(type, field.Type.BaseType, "Íĺâĺđíűé ňčď äë˙ " + name);
- Assert.AreEqual(modifiers, field.Attributes, "Íĺâĺđíűé ěîäčôčęŕňîđ äîńňóďŕ äë˙ " + name);
+ Assert.IsNotNull(field,
+ String.Format(CultureInfo.CurrentCulture, "{0} is not a field.", member.Name));
+ Assert.AreEqual(name, field.Name, Settings.Default.InvalidName);
+ Assert.AreEqual(type, field.Type.BaseType,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.InvalidType, name));
+ Assert.AreEqual(modifiers, field.Attributes,
+ String.Format(CultureInfo.CurrentCulture, Settings.Default.InvalidAccessModifier, name));
}
/// <summary>
@@ -204,8 +211,8 @@
/// <param name="namespaces">The count of namespaces in the <paramref name="compileUnit"/>.</param>
public static void CheckCompileUnit(CodeCompileUnit compileUnit, int namespaces)
{
- Assert.IsNotNull(compileUnit, "compileUnit ďóńňîé.");
- Assert.AreEqual(namespaces, compileUnit.Namespaces.Count, "Íĺâĺđíîĺ ęîëč÷ĺńňâî namespaces.");
+ Assert.IsNotNull(compileUnit, Settings.Default.CompileUnitEmpty);
+ Assert.AreEqual(namespaces, compileUnit.Namespaces.Count, Settings.Default.WrongNumberWorkspaces);
}
#endregion
Modified: vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/Tests/TestEnum.cs
==============================================================================
--- vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/Tests/TestEnum.cs (original)
+++ vs-plugin/trunk/Nemerle.VsIntegration.Tests/Utils/Tests/TestEnum.cs Tue Sep 26 03:08:45 2006
@@ -5,23 +5,23 @@
internal enum TestEnum
{
/// <summary>
- /// Ďđîńňŕ˙ ôîđěŕ.
+ /// A simple form.
/// </summary>
Form1,
/// <summary>
- /// Ďđîńňŕ˙ ëîęŕëčçîâŕííŕ˙ ôîđěŕ.
+ /// A simple localized form.
/// </summary>
Form2,
/// <summary>
- /// Ôîđěŕ ńîäĺđćčň Button č ErrorProvider.
+ /// A form with a button and a error provider controls.
/// </summary>
Form3,
/// <summary>
- /// Ôîđěŕ ńîäĺđćčň ComboBox č TreeView.
+ /// A form with a combo box č tree view controls.
/// </summary>
Form4,
/// <summary>
- /// Ôîđěŕ ńîäĺđćčň îáđŕáîň÷čę ńîáűňč˙ Click.
+ /// A form with a Click event handler.
/// </summary>
Form5,
}
Added: vs-plugin/trunk/Nemerle.VsIntegration.Tests/app.config
==============================================================================
--- (empty file)
+++ vs-plugin/trunk/Nemerle.VsIntegration.Tests/app.config Tue Sep 26 03:08:45 2006
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <configSections>
+ <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
+ <section name="Nemerle.VsIntegration.Tests.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+ </sectionGroup>
+ </configSections>
+ <applicationSettings>
+ <Nemerle.VsIntegration.Tests.Properties.Settings>
+ <setting name="WrongNumberBaseTypes" serializeAs="String">
+ <value>Wrong number of base types for {0} class.</value>
+ </setting>
+ <setting name="WrongNumberMembers" serializeAs="String">
+ <value>Wrong number of members in {0} class.</value>
+ </setting>
+ <setting name="InvalidAccessModifier" serializeAs="String">
+ <value>Invalid access modifier for {0}.</value>
+ </setting>
+ <setting name="InvalidBaseType" serializeAs="String">
+ <value>Invalid base type for {0} class.</value>
+ </setting>
+ <setting name="InvalidName" serializeAs="String">
+ <value>Invalid name.</value>
+ </setting>
+ <setting name="IsNotClass" serializeAs="String">
+ <value>{0} is not a class.</value>
+ </setting>
+ <setting name="WrongNumberWorkspaces" serializeAs="String">
+ <value>Wrong number of namespaces.</value>
+ </setting>
+ <setting name="CompileUnitEmpty" serializeAs="String">
+ <value>Compile unit is empty.</value>
+ </setting>
+ <setting name="InvalidParametersCount" serializeAs="String">
+ <value>Invalid parameters count in {0} method.</value>
+ </setting>
+ <setting name="InvalidType" serializeAs="String">
+ <value>Invalid type for {0}.</value>
+ </setting>
+ <setting name="InvalidReturnType" serializeAs="String">
+ <value>Invalid return type for {0} method.</value>
+ </setting>
+ <setting name="WrongNumberTypes" serializeAs="String">
+ <value>Wrong number of types for {0} namespace.</value>
+ </setting>
+ <setting name="WrongNumberUsings" serializeAs="String">
+ <value>Wrong number of usings for {0} namespace.</value>
+ </setting>
+ <setting name="InvalidNamespace" serializeAs="String">
+ <value>Invalid namespace.</value>
+ </setting>
+ <setting name="InvalidUsing" serializeAs="String">
+ <value>Invalid using for {0}.</value>
+ </setting>
+ <setting name="NotFoundCodeStream" serializeAs="String">
+ <value>Did not find code stream for {0}.</value>
+ </setting>
+ </Nemerle.VsIntegration.Tests.Properties.Settings>
+ </applicationSettings>
+</configuration>
\ No newline at end of file
Added: vs-plugin/trunk/Nemerle.VsIntegration.Tests/key.snk
==============================================================================
Binary file. No diff available.
More information about the svn
mailing list