diff --git a/data/resources/StringResources.de.resx b/data/resources/StringResources.de.resx index aa4ea7305c..bc5f5117f2 100644 --- a/data/resources/StringResources.de.resx +++ b/data/resources/StringResources.de.resx @@ -4033,6 +4033,12 @@ Grund: Der Wert zu dem zurückgesetzt werden soll ist ungültig weil sich eine a Das öffentliche Schlüsseltoken der Assembly + + Assembly referenzieren + + + Wenn auf false gesetzt, gibt diese Referenz nur eine Build-Reihenfolgenabhängigkeit an und fügt keine Assembly-Referenz zum Projekt hinzu. + Festgelegte Version @@ -4979,6 +4985,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Kopiere Wert in Zwischenablage + + Name + Nicht-öffentliche Mitglieder @@ -5000,6 +5009,12 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Statische Mitglieder + + Typ + + + Wert + Speicher @@ -5375,6 +5390,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Öffne beinhaltenden Ordner im Explorer + + Kommandozeile hier öffnen + Alle Knoten einklappen @@ -5510,6 +5528,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< Projekt sta&rten + + Projekt ohne Debugger starten + Als St&artprojekt festlegen diff --git a/data/resources/StringResources.fr.resx b/data/resources/StringResources.fr.resx index 2f0e2f9e55..2ea1fca7a5 100644 --- a/data/resources/StringResources.fr.resx +++ b/data/resources/StringResources.fr.resx @@ -1862,6 +1862,9 @@ Voulez-vous ajouter le nouveau fichier au projet ${CurrentProjectName}? Pas-à-pas en cours + + Décompiler le code sans symboles + Utiliser 'Seulement mon code' pour le pas-à-pas @@ -3379,6 +3382,9 @@ Configurez le chemin vers NAnt dans les options de SharpDevelop. L'élément sélectionné n'est ni une classe ni un membre surchargeable: aucun symbole dérivé n'est disponible. + + Impossible de trouver la définition du type sous le curseur. + Envoyer cette ligne vers la console Ruby @@ -3774,6 +3780,9 @@ Toutes les modifications seront perdues. Impossible de charger le concepteur. Vérifier les erreurs de syntaxe du code source et si toutes les références sont disponibles. + + Une ou plusieurs erreurs sont survenues en essayant de vider le contenu du concepteur. C'est peut-être une exception non gérée dans un composant tiers sur le formulaire ou le contrôle. + Ne peut charger la librairie contenant la barre de composants. Les composants Windows Form ne seront pas accessibles, veuillez configurer manuellement la barre de composants (clic droit sur une catégorie de la barre de menu -> Paramétrer la barre de menu). @@ -3988,6 +3997,12 @@ Utilisez seulement des lettres, chiffres, espace, '.' ou '_'. La culture supportée par la référence + + Embarquer les types interop + + + Précise si les type d'interop COM définis dans l'assembly référencé sont embarqués dans l'assembly cible. + Copie locale @@ -4006,6 +4021,12 @@ Utilisez seulement des lettres, chiffres, espace, '.' ou '_'. Le jeton de clé publique + + Référencer l'assembly + + + Si positionné à Faux, cette référence spécifie uniquement une dépendance dans l'ordre de la construction sans référencer l'assembly. + Version Spécifique @@ -4051,6 +4072,9 @@ Utilisez seulement des lettres, chiffres, espace, '.' ou '_'. Chargement de ${Filename}... + + Fermer la solution + Laisser la solution précédente ouverte @@ -4084,6 +4108,14 @@ Utilisez seulement des lettres, chiffres, espace, '.' ou '_'. Mettre à jour le projet + + Le projet '${ProjectName}' cible MSBuild ${OldToolsVersion}, mais cette version n'est pas installée. +Voulez vous mettre à jour le projet vers MSBuild ${NewToolsVersion}? +Le projet ne sera pas ouvert sans cette mise à jour. + + + Mettre à jour vers MSBuild ${NewToolsVersion} + Cette solution a été créée par une précédente version de SharpDevelop. La mettre à jour vous permet d'utiliser de nouveaux languages, ou les évolutions du framework. @@ -4165,7 +4197,7 @@ Allez dans 'Outils/Options->Style Visuel pour changer l'ambiance actuelle.Processus de travail {0} ASP.NET/IIS(Express) introuvable. - Pas d'URL du projet spécifiée ou de programme externe. Vérifier le serveur web dans Propriétés du projet - Onglet debug. + Aucun programme externe ni URL spécifié. Vérifier le serveur web dans Propriétés du projet - onglet Web. Port: @@ -4783,7 +4815,7 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Vous ne pouvez pas changer pour une fonction sans symboles. - Les options de décompilation du code doivent être activés pour aller vers une fonction sans symboles. + Impossible de basculer vers une méthode sans symboles de déboguage.Recompilez avec les symboles ou activer l'option de décompilation du code sans symboles. [Méthodes externes] @@ -4941,6 +4973,9 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Copier la valeur dans le presse-papier + + Nom + Membres non publics @@ -4962,6 +4997,12 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Membres statiques + + Type + + + Valeur + Mémoire @@ -5001,12 +5042,18 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Adresse + + (dynamique) + Aucun symbole n'est chargé. Symboles chargés. + + (en mémoire) + Ordre @@ -5331,6 +5378,9 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Ouvrir le répertoire dans l'explorateur + + Ouvrir une invite de commande ici + Réduire tous les noeuds @@ -5466,6 +5516,9 @@ Soit ils n'existent pas, soit le document Wix n'est pas pour WiX 3.0 et l'espace Lance&r projet + + Exécuter ce projet sans débogueur + Définir comme projet de dém&arrage diff --git a/data/resources/StringResources.nl.resx b/data/resources/StringResources.nl.resx index 4ccfb33a77..5660fe197f 100644 --- a/data/resources/StringResources.nl.resx +++ b/data/resources/StringResources.nl.resx @@ -4023,6 +4023,12 @@ Alleen letters, getallen, spatie, '.' of '_' zijn toegestaan. De openbare sleutel token + + Referentie assembly + + + Indien false, specificeert deze referentie enkel een bouw-volgorde afhankelijkheid en heeft niet tot gevolg dat de assembly gerefereerd wordt. + Specifieke versie @@ -4969,6 +4975,9 @@ Microsoft.Tools.WindowsInstallerXml.Extenties.NetFxCompiler, WixNetFxExtentie Kopieer waarde naar klembord + + Naam + Niet openbare leden @@ -4990,6 +4999,12 @@ Microsoft.Tools.WindowsInstallerXml.Extenties.NetFxCompiler, WixNetFxExtentie Statische leden + + Type + + + Waarde + Geheugen @@ -5365,6 +5380,9 @@ Microsoft.Tools.WindowsInstallerXml.Extenties.NetFxCompiler, WixNetFxExtentie Open de document bevattende map in de Explorer + + Open hier de commando prompt + Alle knooppunten invouwen @@ -5500,6 +5518,9 @@ Microsoft.Tools.WindowsInstallerXml.Extenties.NetFxCompiler, WixNetFxExtentie P&roject starten + + Project uitvoeren zonder foutopsporing + Als startproject instellen. diff --git a/data/resources/StringResources.resx b/data/resources/StringResources.resx index 363b3b0163..f0096690f8 100644 --- a/data/resources/StringResources.resx +++ b/data/resources/StringResources.resx @@ -5270,6 +5270,9 @@ Stop/terminate the debuggee. Copy value to clipboard Item in variable's context menu + + Name + Non-Public members @@ -5297,6 +5300,12 @@ Shows the full callstack of the error. Static members + + Type + + + Value + Memory @@ -5686,6 +5695,9 @@ Removed the end part of the original message ", reason '${Message}'" since this Open containing folder in Explorer String for the editor tab context menu that will open the directory in which a documents file is contained in Windows Explorer. + + Open command prompt here + Collapse all nodes @@ -5830,6 +5842,9 @@ Removed the end part of the original message ", reason '${Message}'" since this &Run Project + + Run Project without Debugger + Set as St&artUp Project diff --git a/data/templates/packages/Modernizr.1.7.nupkg b/data/templates/packages/Modernizr.1.7.nupkg deleted file mode 100644 index df76835723..0000000000 Binary files a/data/templates/packages/Modernizr.1.7.nupkg and /dev/null differ diff --git a/data/templates/packages/Modernizr.2.5.3.nupkg b/data/templates/packages/Modernizr.2.5.3.nupkg new file mode 100644 index 0000000000..98ade6d191 Binary files /dev/null and b/data/templates/packages/Modernizr.2.5.3.nupkg differ diff --git a/data/templates/packages/jQuery.1.6.1.nupkg b/data/templates/packages/jQuery.1.6.1.nupkg deleted file mode 100644 index 7591b33c89..0000000000 Binary files a/data/templates/packages/jQuery.1.6.1.nupkg and /dev/null differ diff --git a/data/templates/packages/jQuery.1.7.2.nupkg b/data/templates/packages/jQuery.1.7.2.nupkg new file mode 100644 index 0000000000..033bae95d0 Binary files /dev/null and b/data/templates/packages/jQuery.1.7.2.nupkg differ diff --git a/data/templates/project/CSharp/MvcRazorProject.xpt b/data/templates/project/CSharp/MvcRazorProject.xpt index 37e610e87b..d517855fe8 100644 --- a/data/templates/project/CSharp/MvcRazorProject.xpt +++ b/data/templates/project/CSharp/MvcRazorProject.xpt @@ -273,8 +273,8 @@ Aliquam suscipit tellus vel nunc elementum fringilla.

@ViewBag.Title - - + +
@@ -300,8 +300,8 @@ Aliquam suscipit tellus vel nunc elementum fringilla.

- - + + ]]> diff --git a/data/templates/project/CSharp/MvcWebProject.xpt b/data/templates/project/CSharp/MvcWebProject.xpt index bd14354e5e..93d614f7d1 100644 --- a/data/templates/project/CSharp/MvcWebProject.xpt +++ b/data/templates/project/CSharp/MvcWebProject.xpt @@ -280,8 +280,8 @@ namespace ${StandardNamespace} <asp:ContentPlaceHolder id="Title" runat="server"/> " rel="stylesheet" type="text/css"> - - + +
@@ -307,8 +307,8 @@ namespace ${StandardNamespace} - - + + ]]> diff --git a/data/templates/project/VB/MvcRazorProject.xpt b/data/templates/project/VB/MvcRazorProject.xpt index bd94faf848..87ba3a7275 100644 --- a/data/templates/project/VB/MvcRazorProject.xpt +++ b/data/templates/project/VB/MvcRazorProject.xpt @@ -265,8 +265,8 @@ Aliquam suscipit tellus vel nunc elementum fringilla.

@ViewData("Title") - - + +
@@ -292,8 +292,8 @@ Aliquam suscipit tellus vel nunc elementum fringilla.

- - + + ]]> diff --git a/data/templates/project/VB/MvcWebProject.xpt b/data/templates/project/VB/MvcWebProject.xpt index f472bafb05..5be3b65b5a 100644 --- a/data/templates/project/VB/MvcWebProject.xpt +++ b/data/templates/project/VB/MvcWebProject.xpt @@ -272,8 +272,8 @@ End Class <asp:ContentPlaceHolder id="Title" runat="server"/> " rel="stylesheet" type="text/css"> - - + +
@@ -299,8 +299,8 @@ End Class - - + + ]]> diff --git a/samples/MSTest/MSTest.SharpDevelop.Tests/MSTest.SharpDevelop.Tests.csproj b/samples/MSTest/MSTest.SharpDevelop.Tests/MSTest.SharpDevelop.Tests.csproj new file mode 100644 index 0000000000..8334f2708a --- /dev/null +++ b/samples/MSTest/MSTest.SharpDevelop.Tests/MSTest.SharpDevelop.Tests.csproj @@ -0,0 +1,69 @@ + + + + {51D56190-67B7-4A49-BA0A-24010460CCC6} + Debug + x86 + Library + MSTest.SharpDevelop.Tests + MSTest.SharpDevelop.Tests + v4.0 + Properties + + + x86 + + + bin\Debug\ + True + Full + False + True + DEBUG;TRACE + + + bin\Release\ + False + None + True + False + TRACE + + + + ..\..\..\bin\ICSharpCode.Core.dll + + + ..\..\..\bin\ICSharpCode.SharpDevelop.dll + + + ..\..\..\bin\ICSharpCode.SharpDevelop.Dom.dll + + + ..\..\..\src\Tools\NUnit\nunit.framework.dll + + + ..\..\..\src\Libraries\RhinoMocks\Rhino.Mocks.dll + + + + 3.5 + + + + ..\..\..\AddIns\Analysis\UnitTesting\UnitTesting.dll + + + + + + + + + + {8DF3A610-47F9-4448-B455-952BD57CB5CC} + MSTest.SharpDevelop + + + + \ No newline at end of file diff --git a/samples/MSTest/MSTest.SharpDevelop.Tests/MSTestFrameworkTests.cs b/samples/MSTest/MSTest.SharpDevelop.Tests/MSTestFrameworkTests.cs new file mode 100644 index 0000000000..be70c9d48c --- /dev/null +++ b/samples/MSTest/MSTest.SharpDevelop.Tests/MSTestFrameworkTests.cs @@ -0,0 +1,338 @@ +// 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.Linq; + +using ICSharpCode.MSTest; +using ICSharpCode.SharpDevelop.Dom; +using ICSharpCode.SharpDevelop.Project; +using ICSharpCode.UnitTesting; +using NUnit.Framework; +using Rhino.Mocks; + +namespace MSTest.SharpDevelop.Tests +{ + [TestFixture] + public class MSTestFrameworkTests + { + MSTestFramework testFramework; + IProject fakeProject; + + [SetUp] + public void Init() + { + testFramework = new MSTestFramework(); + + fakeProject = MockRepository.GenerateStub(); + fakeProject.Stub(p => p.SyncRoot).Return(fakeProject); + } + + void AddReferencesToProject(params string[] referenceNames) + { + List projectItems = referenceNames + .Select(name => new ReferenceProjectItem(fakeProject, name) as ProjectItem) + .ToList(); + + AddItemsToProject(projectItems); + } + + void AddItemsToProject(List projectItems) + { + fakeProject + .Stub(project => project.Items) + .Return(new ReadOnlyCollection(projectItems)); + } + + void AddFileAndReferenceToProject(string fileName, string reference) + { + var projectItems = new List(); + projectItems.Add(new FileProjectItem(fakeProject, ItemType.Compile, fileName)); + projectItems.Add(new ReferenceProjectItem(fakeProject, reference)); + + AddItemsToProject(projectItems); + } + + void NoItemsInProject() + { + AddReferencesToProject(); + } + + IClass CreateClassWithoutAnyAttributes() + { + IClass fakeClass = MockRepository.GenerateStub(); + AddAttributesToClass(fakeClass, new List()); + return fakeClass; + } + + void AddAttributesToClass(IClass fakeClass, List attributes) + { + fakeClass.Stub(c => c.Attributes).Return(attributes); + } + + IClass CreateClassWithAttributes(params string[] attributeNames) + { + IClass fakeClass = MockRepository.GenerateStub(); + + List attributes = CreateAttributes(attributeNames); + + AddAttributesToClass(fakeClass, attributes); + + return fakeClass; + } + + List CreateAttributes(params string[] attributeNames) + { + return attributeNames.Select(name => CreateAttribute(name)).ToList(); + } + + IAttribute CreateAttribute(string name) + { + IReturnType returnType = MockRepository.GenerateStub(); + returnType.Stub(t => t.FullyQualifiedName).Return(name); + + IAttribute attribute = MockRepository.GenerateStub(); + attribute.Stub(a => a.AttributeType).Return(returnType); + return attribute; + } + + void MakeClassAbstract(IClass fakeClass) + { + fakeClass.Stub(c => c.IsAbstract).Return(true); + } + + IMethod CreateMethodWithoutAnyAttributes() + { + IMethod fakeMethod = MockRepository.GenerateStub(); + AddAttributesToMethod(fakeMethod, new List()); + return fakeMethod; + } + + IMethod CreateMethodWithAttributes(params string[] attributeNames) + { + IMethod fakeMethod = MockRepository.GenerateStub(); + List attributes = CreateAttributes(attributeNames); + AddAttributesToMethod(fakeMethod, attributes); + return fakeMethod; + } + + void AddAttributesToMethod(IMethod method, List attributes) + { + method.Stub(m => m.Attributes).Return(attributes); + } + + List GetTestMembersFor(IClass fakeClass) + { + return testFramework.GetTestMembersFor(fakeClass).ToList(); + } + + void AddMethodsToClass(IClass fakeClass, List methods) + { + fakeClass.Stub(c => c.Methods).Return(methods); + } + + [Test] + public void IsTestProject_NullProject_ReturnsFalse() + { + bool result = testFramework.IsTestProject(null); + + Assert.IsFalse(result); + } + + [Test] + public void IsTestProject_ProjectWithMSTestAssemblyReference_ReturnsTrue() + { + AddReferencesToProject("System", "Microsoft.VisualStudio.QualityTools.UnitTestFramework"); + + bool result = testFramework.IsTestProject(fakeProject); + + Assert.IsTrue(result); + } + + [Test] + public void IsTestProject_ProjectWithoutMSTestAssemblyReference_ReturnsFalse() + { + NoItemsInProject(); + bool result = testFramework.IsTestProject(fakeProject); + + Assert.IsFalse(result); + } + + [Test] + public void IsTestProject_ProjectWithMSTestAssemblyReferenceInUpperCase_ReturnsTrue() + { + AddReferencesToProject("MICROSOFT.VISUALSTUDIO.QUALITYTOOLS.UNITTESTFRAMEWORK"); + + bool result = testFramework.IsTestProject(fakeProject); + + Assert.IsTrue(result); + } + + [Test] + public void IsTestProject_ProjectWithMSTestAssemblyReferenceAndFileProjectItem_ReturnsTrue() + { + AddFileAndReferenceToProject("test.cs", "Microsoft.VisualStudio.QualityTools.UnitTestFramework"); + + bool result = testFramework.IsTestProject(fakeProject); + + Assert.IsTrue(result); + } + + [Test] + public void IsTestProject_ProjectWithMSTestAssemblyReferenceUsingFullName_ReturnsTrue() + { + AddReferencesToProject("Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=2.5.3.9345, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77"); + + bool result = testFramework.IsTestProject(fakeProject); + + Assert.IsTrue(result); + } + + [Test] + public void IsTestClass_ClassHasNoAttributes_ReturnsFalse() + { + IClass fakeClass = CreateClassWithoutAnyAttributes(); + + bool result = testFramework.IsTestClass(fakeClass); + + Assert.IsFalse(result); + } + + [Test] + public void IsTestClass_ClassHasTestFixtureAttributeMissingAttributePart_ReturnsTrue() + { + IClass fakeClass = CreateClassWithAttributes("TestClass"); + + bool result = testFramework.IsTestClass(fakeClass); + + Assert.IsTrue(result); + } + + [Test] + public void IsTestClass_ClassHasTestClassAttributeAndIsAbstract_ReturnsFalse() + { + IClass fakeClass = CreateClassWithAttributes("TestClass"); + MakeClassAbstract(fakeClass); + + bool result = testFramework.IsTestClass(fakeClass); + + Assert.IsFalse(result); + } + + [Test] + public void IsTestClass_ClassHasTestClassAttributeIncludingAttributePart_ReturnsTrue() + { + IClass fakeClass = CreateClassWithAttributes("TestClassAttribute"); + + bool result = testFramework.IsTestClass(fakeClass); + + Assert.IsTrue(result); + } + + [Test] + public void IsTestClass_ClassHasFullyQualifiedMSTestClassAttribute_ReturnsTrue() + { + IClass fakeClass = CreateClassWithAttributes("Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute"); + + bool result = testFramework.IsTestClass(fakeClass); + + Assert.IsTrue(result); + } + + [Test] + public void IsTestClass_ClassIsNull_ReturnsFalse() + { + bool result = testFramework.IsTestClass(null); + + Assert.IsFalse(result); + } + + [Test] + public void IsTestMember_MethodHasNoAttributes_ReturnsFalse() + { + IMethod method = CreateMethodWithoutAnyAttributes(); + + bool result = testFramework.IsTestMember(method); + + Assert.IsFalse(result); + } + + [Test] + public void IsTestMember_MethodHasTestMethodAttributeWithoutAttributePart_ReturnsTrue() + { + IMethod method = CreateMethodWithAttributes("TestMethod"); + + bool result = testFramework.IsTestMember(method); + + Assert.IsTrue(result); + } + + [Test] + public void IsTestMember_MethodHasTestMethodAttributeAttribute_ReturnsTrue() + { + IMethod method = CreateMethodWithAttributes("TestMethodAttribute"); + + bool result = testFramework.IsTestMember(method); + + Assert.IsTrue(result); + } + + [Test] + public void IsTestMember_MethodHasFullyQualifiedMSTestTestMethodAttribute_ReturnsTrue() + { + IMethod method = CreateMethodWithAttributes("Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute"); + + bool result = testFramework.IsTestMember(method); + + Assert.IsTrue(result); + } + + [Test] + public void IsTestMember_MethodIsNull_ReturnsFalse() + { + bool result = testFramework.IsTestMember(null); + + Assert.IsFalse(result); + } + + [Test] + public void IsTestMember_MemberNotMethod_ReturnsFalse() + { + IMember member = MockRepository.GenerateStub(); + + bool result = testFramework.IsTestMember(member); + + Assert.IsFalse(result); + } + + [Test] + public void GetTestMembersFor_ClassHasNoMethods_ReturnsFalse() + { + IClass fakeClass = CreateClassWithAttributes("TestClass"); + AddMethodsToClass(fakeClass, new List()); + + List testMembers = GetTestMembersFor(fakeClass); + + Assert.AreEqual(0, testMembers.Count); + } + + [Test] + public void GetTestMembersFor_ClassHasTwoMethodsAndSecondOneIsTestMethod_ReturnsSecondTestMethodOnly() + { + IClass fakeClass = CreateClassWithAttributes("TestClass"); + + var methods = new List(); + methods.Add(CreateMethodWithoutAnyAttributes()); + IMethod testMethod = CreateMethodWithAttributes("TestMethod"); + methods.Add(testMethod); + AddMethodsToClass(fakeClass, methods); + + List testMembers = GetTestMembersFor(fakeClass); + + Assert.AreEqual(1, testMembers.Count); + Assert.AreEqual(testMethod, testMembers[0].Member); + } + } +} diff --git a/samples/MSTest/MSTest.SharpDevelop.Tests/MSTestResultsTests.cs b/samples/MSTest/MSTest.SharpDevelop.Tests/MSTestResultsTests.cs new file mode 100644 index 0000000000..c5304011f6 --- /dev/null +++ b/samples/MSTest/MSTest.SharpDevelop.Tests/MSTestResultsTests.cs @@ -0,0 +1,184 @@ +// 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.Xml; +using ICSharpCode.MSTest; +using ICSharpCode.SharpDevelop.Dom; +using ICSharpCode.UnitTesting; +using NUnit.Framework; + +namespace MSTest.SharpDevelop.Tests +{ + [TestFixture] + public class MSTestResultsTests + { + MSTestResults testResults; + + void CreateMSTestResults(string xml) + { + using (var reader = new XmlTextReader(new StringReader(xml))) { + testResults = new MSTestResults(reader); + } + } + + void AssertTestResultsAreEqual(TestResult[] expectedResults) + { + List expectedResultsAsString = ConvertToStrings(expectedResults); + List actualResultsAsString = ConvertToStrings(testResults); + CollectionAssert.AreEqual(expectedResultsAsString, actualResultsAsString); + } + + List ConvertToStrings(IEnumerable results) + { + return results.Select( + result => String.Format( + "Name: {0}, Result: {1}, Message: '{2}', StackTrace: '{3}', StackPosition: {4}", + result.Name, + result.ResultType, + result.Message, + result.StackTrace, + result.StackTraceFilePosition)) + .ToList(); + } + + [Test] + public void Results_OneClassWithTwoPassingTestMethods_ReturnsTwoResults() + { + CreateMSTestResults(oneClassWithTwoPassingTestMethods); + + var expectedResults = new TestResult[] { + new TestResult("FooTest.UnitTest1.TestMethod1") { + ResultType = TestResultType.Success + }, + new TestResult("FooTest.UnitTest1.TestMethod2") { + ResultType = TestResultType.Success + }, + }; + AssertTestResultsAreEqual(expectedResults); + } + + string oneClassWithTwoPassingTestMethods = + +@" + + + These are default test settings for a local test run. + + + + + + + + + + + + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +"; + + [Test] + public void Results_OneTestMethodThrowsException_ReturnsOneErrorResultWithStackTrace() + { + CreateMSTestResults(oneTestMethodThrowsException); + + var expectedResults = new TestResult[] { + new TestResult("FooTest.UnitTest1.TestMethod1") { + ResultType = TestResultType.Failure, + Message = "System.ApplicationException: asdfafds", + StackTrace = " at FooTest.UnitTest1.TestMethod1() in d:\\projects\\FooTest\\UnitTest1.cs:line 21\r\n", + StackTraceFilePosition = new FilePosition(@"d:\projects\FooTest\UnitTest1.cs", 21, 1) + } + }; + AssertTestResultsAreEqual(expectedResults); + } + + string oneTestMethodThrowsException = + +@" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Test method FooTest.UnitTest1.TestMethod1 threw exception: +System.ApplicationException: asdfafds + at FooTest.UnitTest1.TestMethod1() in d:\projects\FooTest\UnitTest1.cs:line 21 + + + + + +"; + } +} diff --git a/samples/MSTest/MSTest.SharpDevelop.Tests/Properties/AssemblyInfo.cs b/samples/MSTest/MSTest.SharpDevelop.Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..cdff605abd --- /dev/null +++ b/samples/MSTest/MSTest.SharpDevelop.Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,31 @@ +#region Using directives + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +#endregion + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MSTest.SharpDevelop.Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MSTest.SharpDevelop.Tests")] +[assembly: AssemblyCopyright("Copyright 2012")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all the values or you can use the default the Revision and +// Build Numbers by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0")] diff --git a/samples/MSTest/MSTest.SharpDevelop.sln b/samples/MSTest/MSTest.SharpDevelop.sln new file mode 100644 index 0000000000..6166e73ff1 --- /dev/null +++ b/samples/MSTest/MSTest.SharpDevelop.sln @@ -0,0 +1,24 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +# SharpDevelop 4.2.0.8749-Beta 2 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSTest.SharpDevelop", "MSTest.SharpDevelop\MSTest.SharpDevelop.csproj", "{8DF3A610-47F9-4448-B455-952BD57CB5CC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSTest.SharpDevelop.Tests", "MSTest.SharpDevelop.Tests\MSTest.SharpDevelop.Tests.csproj", "{51D56190-67B7-4A49-BA0A-24010460CCC6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8DF3A610-47F9-4448-B455-952BD57CB5CC}.Debug|x86.Build.0 = Debug|x86 + {8DF3A610-47F9-4448-B455-952BD57CB5CC}.Debug|x86.ActiveCfg = Debug|x86 + {8DF3A610-47F9-4448-B455-952BD57CB5CC}.Release|x86.Build.0 = Release|x86 + {8DF3A610-47F9-4448-B455-952BD57CB5CC}.Release|x86.ActiveCfg = Release|x86 + {51D56190-67B7-4A49-BA0A-24010460CCC6}.Debug|x86.Build.0 = Debug|x86 + {51D56190-67B7-4A49-BA0A-24010460CCC6}.Debug|x86.ActiveCfg = Debug|x86 + {51D56190-67B7-4A49-BA0A-24010460CCC6}.Release|x86.Build.0 = Release|x86 + {51D56190-67B7-4A49-BA0A-24010460CCC6}.Release|x86.ActiveCfg = Release|x86 + EndGlobalSection +EndGlobal diff --git a/samples/MSTest/MSTest.SharpDevelop/MSTest.SharpDevelop.csproj b/samples/MSTest/MSTest.SharpDevelop/MSTest.SharpDevelop.csproj new file mode 100644 index 0000000000..05165c7eb6 --- /dev/null +++ b/samples/MSTest/MSTest.SharpDevelop/MSTest.SharpDevelop.csproj @@ -0,0 +1,103 @@ + + + + {8DF3A610-47F9-4448-B455-952BD57CB5CC} + Debug + x86 + Library + ICSharpCode.MSTest + MSTest.SharpDevelop + v4.0 + Properties + ..\..\..\AddIns\Samples\MSTest + False + False + 4 + false + + + x86 + False + Auto + 4194304 + 4096 + + + true + Full + False + True + DEBUG;TRACE + + + False + None + True + False + TRACE + + + + ..\..\..\bin\ICSharpCode.Core.dll + False + + + ..\..\..\bin\ICSharpCode.Core.Presentation.dll + False + + + ..\..\..\bin\ICSharpCode.SharpDevelop.dll + False + + + ..\..\..\bin\ICSharpCode.SharpDevelop.Dom.dll + False + + + ..\..\..\bin\ICSharpCode.SharpDevelop.Widgets.dll + False + + + + + + 3.5 + + + 4.0 + + + + ..\..\..\AddIns\Analysis\UnitTesting\UnitTesting.dll + False + + + + + + + + + + + MSTestOptionsPanel.xaml + Code + + + + + + + + + + + + Always + + + + + + + \ No newline at end of file diff --git a/samples/MSTest/MSTest.SharpDevelop/MSTest.addin b/samples/MSTest/MSTest.SharpDevelop/MSTest.addin new file mode 100644 index 0000000000..3049a6c8d0 --- /dev/null +++ b/samples/MSTest/MSTest.SharpDevelop/MSTest.addin @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/samples/MSTest/MSTest.SharpDevelop/MSTestApplication.cs b/samples/MSTest/MSTest.SharpDevelop/MSTestApplication.cs new file mode 100644 index 0000000000..62e3985228 --- /dev/null +++ b/samples/MSTest/MSTest.SharpDevelop/MSTestApplication.cs @@ -0,0 +1,46 @@ +// 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.Diagnostics; + +using ICSharpCode.UnitTesting; + +namespace ICSharpCode.MSTest +{ + public class MSTestApplication + { + SelectedTests selectedTests; + string resultsFileName; + + public MSTestApplication(SelectedTests selectedTests, string resultsFileName) + { + this.selectedTests = selectedTests; + this.resultsFileName = resultsFileName; + GetProcessStartInfo(); + } + + void GetProcessStartInfo() + { + ProcessStartInfo = new ProcessStartInfo(MSTestOptions.MSTestPath, GetCommandLine()); + } + + string GetCommandLine() + { + var commandLine = new MSTestApplicationCommandLine(); + commandLine.AppendQuoted("testcontainer", selectedTests.Project.OutputAssemblyFullPath); + commandLine.AppendQuoted("resultsfile", resultsFileName); + commandLine.Append("detail", "errorstacktrace"); + if (selectedTests.NamespaceFilter != null) { + commandLine.Append("test", selectedTests.NamespaceFilter); + } else if (selectedTests.Member != null) { + commandLine.Append("test", selectedTests.Member.FullyQualifiedName); + } else if (selectedTests.Class != null) { + commandLine.Append("test", selectedTests.Class.FullyQualifiedName); + } + return commandLine.ToString(); + } + + public ProcessStartInfo ProcessStartInfo { get; private set; } + } +} diff --git a/samples/MSTest/MSTest.SharpDevelop/MSTestApplicationCommandLine.cs b/samples/MSTest/MSTest.SharpDevelop/MSTestApplicationCommandLine.cs new file mode 100644 index 0000000000..669d88bba7 --- /dev/null +++ b/samples/MSTest/MSTest.SharpDevelop/MSTestApplicationCommandLine.cs @@ -0,0 +1,37 @@ +// 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; + +namespace ICSharpCode.MSTest +{ + public class MSTestApplicationCommandLine + { + StringBuilder commandLine = new StringBuilder(); + + public MSTestApplicationCommandLine() + { + } + + public void Append(string argument, string value) + { + AppendFormat("/{0}:{1} ", argument, value); + } + + public void AppendQuoted(string argument, string value) + { + AppendFormat("/{0}:\"{1}\" ", argument, value); + } + + void AppendFormat(string format, string argument, string value) + { + commandLine.AppendFormat(format, argument, value); + } + + public override string ToString() + { + return commandLine.ToString(); + } + } +} diff --git a/samples/MSTest/MSTest.SharpDevelop/MSTestDebugger.cs b/samples/MSTest/MSTest.SharpDevelop/MSTestDebugger.cs new file mode 100644 index 0000000000..aa4ad68eee --- /dev/null +++ b/samples/MSTest/MSTest.SharpDevelop/MSTestDebugger.cs @@ -0,0 +1,134 @@ +// 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.Diagnostics; +using System.IO; + +using ICSharpCode.SharpDevelop.Debugging; +using ICSharpCode.UnitTesting; + +namespace ICSharpCode.MSTest +{ + public class MSTestDebugger : TestRunnerBase + { + IUnitTestDebuggerService debuggerService; + IUnitTestMessageService messageService; + IDebugger debugger; + string resultsFileName; + + public MSTestDebugger() + : this( + new UnitTestDebuggerService(), + new UnitTestMessageService()) + { + } + + public MSTestDebugger( + IUnitTestDebuggerService debuggerService, + IUnitTestMessageService messageService) + { + this.debuggerService = debuggerService; + this.messageService = messageService; + this.debugger = debuggerService.CurrentDebugger; + } + + public override void Start(SelectedTests selectedTests) + { + ProcessStartInfo startInfo = GetProcessStartInfo(selectedTests); + if (IsDebuggerRunning) { + if (CanStopDebugging()) { + debugger.Stop(); + Start(startInfo); + } + } else { + Start(startInfo); + } + } + + protected override ProcessStartInfo GetProcessStartInfo(SelectedTests selectedTests) + { + resultsFileName = new MSTestResultsFileName(selectedTests).FileName; + CreateDirectoryForResultsFile(); + var mstestApplication = new MSTestApplication(selectedTests, resultsFileName); + return mstestApplication.ProcessStartInfo; + } + + public bool IsDebuggerRunning { + get { return debuggerService.IsDebuggerLoaded && debugger.IsDebugging; } + } + + bool CanStopDebugging() + { + string question = "${res:XML.MainMenu.RunMenu.Compile.StopDebuggingQuestion}"; + string caption = "${res:XML.MainMenu.RunMenu.Compile.StopDebuggingTitle}"; + return messageService.AskQuestion(question, caption); + } + + void CreateDirectoryForResultsFile() + { + string path = Path.GetDirectoryName(resultsFileName); + if (!Directory.Exists(path)) { + Directory.CreateDirectory(path); + } + } + + void Start(ProcessStartInfo startInfo) + { + StartDebugger(startInfo); + } + + void StartDebugger(ProcessStartInfo startInfo) + { + LogCommandLine(startInfo); + + bool running = false; + debugger.DebugStopped += DebugStopped; + try { + debugger.Start(startInfo); + running = true; + } finally { + if (!running) { + debugger.DebugStopped -= DebugStopped; + } + } + } + + void DebugStopped(object source, EventArgs e) + { + debugger.DebugStopped -= DebugStopped; + + if (File.Exists(resultsFileName)) { + var testResults = new MSTestResults(resultsFileName); + var workbench = new UnitTestWorkbench(); + workbench.SafeThreadAsyncCall(() => UpdateTestResults(testResults)); + } else { + messageService.ShowFormattedErrorMessage("Unable to find test results file: '{0}'.", resultsFileName); + OnAllTestsFinished(source, e); + } + } + + void UpdateTestResults(MSTestResults testResults) + { + foreach (TestResult result in testResults) { + OnTestFinished(this, new TestFinishedEventArgs(result)); + } + OnAllTestsFinished(this, new EventArgs()); + } + + public override void Stop() + { + if (debugger.IsDebugging) { + debugger.Stop(); + } + } + + public override void Dispose() + { + Stop(); + try { + File.Delete(resultsFileName); + } catch { } + } + } +} diff --git a/samples/MSTest/MSTest.SharpDevelop/MSTestFramework.cs b/samples/MSTest/MSTest.SharpDevelop/MSTestFramework.cs new file mode 100644 index 0000000000..50e7d4eb59 --- /dev/null +++ b/samples/MSTest/MSTest.SharpDevelop/MSTestFramework.cs @@ -0,0 +1,109 @@ +// 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.Linq; +using ICSharpCode.SharpDevelop.Dom; +using ICSharpCode.SharpDevelop.Project; +using ICSharpCode.UnitTesting; + +namespace ICSharpCode.MSTest +{ + public class MSTestFramework : ITestFramework + { + public bool IsBuildNeededBeforeTestRun { + get { return true; } + } + + public bool IsTestMember(IMember member) + { + var method = member as IMethod; + if (method == null) + return false; + + return IsTestMethod(method); + } + + bool IsTestMethod(IMethod method) + { + foreach (IAttribute attribute in method.Attributes) { + if (IsMSTestMethodAttribute(attribute)) { + return true; + } + } + + return false; + } + + bool IsMSTestMethodAttribute(IAttribute attribute) + { + return IsMSTestMethodAttribute(attribute.AttributeType.FullyQualifiedName); + } + + bool IsMSTestMethodAttribute(string name) + { + return + name == "TestMethod" || + name == "TestMethodAttribute" || + name == "Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute"; + } + + public bool IsTestClass(IClass c) + { + if ((c == null) || (c.IsAbstract)) + return false; + + foreach (IAttribute attribute in c.Attributes) { + if (IsMSTestClassAttribute(attribute)) { + return true; + } + } + + return false; + } + + bool IsMSTestClassAttribute(IAttribute attribute) + { + return IsMSTestClassAttribute(attribute.AttributeType.FullyQualifiedName); + } + + bool IsMSTestClassAttribute(string name) + { + return + name == "TestClass" || + name == "TestClassAttribute" || + name == "Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute"; + } + + public bool IsTestProject(IProject project) + { + if (project == null) + return false; + + foreach (ProjectItem item in project.Items) { + if (item.IsMSTestAssemblyReference()) { + return true; + } + } + return false; + } + + public IEnumerable GetTestMembersFor(IClass c) + { + return c.Methods + .Where(IsTestMethod) + .Select(method => new TestMember(method)); + } + + public ITestRunner CreateTestRunner() + { + return new MSTestRunner(); + } + + public ITestRunner CreateTestDebugger() + { + return new MSTestDebugger(); + } + } +} \ No newline at end of file diff --git a/samples/MSTest/MSTest.SharpDevelop/MSTestOptions.cs b/samples/MSTest/MSTest.SharpDevelop/MSTestOptions.cs new file mode 100644 index 0000000000..f60a73467b --- /dev/null +++ b/samples/MSTest/MSTest.SharpDevelop/MSTestOptions.cs @@ -0,0 +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 System.IO; +using ICSharpCode.Core; + +namespace ICSharpCode.MSTest +{ + public static class MSTestOptions + { + static Properties properties = PropertyService.Get("MSTestOptions", new Properties()); + + public static string MSTestPath { + get { return properties.Get("MSTestPath", GetDefaultMSTestPath()); } + set { properties.Set("MSTestPath", value); } + } + + static string GetDefaultMSTestPath() + { + return Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), + @"Microsoft Visual Studio 10.0\Common7\IDE\mstest.exe"); + } + } +} diff --git a/samples/MSTest/MSTest.SharpDevelop/MSTestOptionsPanel.xaml b/samples/MSTest/MSTest.SharpDevelop/MSTestOptionsPanel.xaml new file mode 100644 index 0000000000..57da7506a1 --- /dev/null +++ b/samples/MSTest/MSTest.SharpDevelop/MSTestOptionsPanel.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + +