From 84020be622f8010a7605289fb8c7094da3d9f969 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Tue, 12 Aug 2014 10:30:10 +0100 Subject: [PATCH 01/24] Initial tests for annotations, plus work on xunit2 --- .../ExternalAnnotations/xunit.assert.xml | 39 ++ .../test/data/Annotations/Annotations.cs | 614 ++++++++++++++++++ .../ExternalAnnotationsProvider.cs | 60 ++ .../ExternalAnnotationsTestBase2.cs | 123 ++++ .../Annotations/XunitAnnotationsTest.cs | 113 ++++ .../AcceptanceTests/EnvironmentVariables.cs | 2 +- resharper/test/src/tests/tests-rs82.csproj | 7 + resharper/xunitcontrib-resharper8.2.sln | 8 +- 8 files changed, 964 insertions(+), 2 deletions(-) create mode 100644 resharper/ExternalAnnotations/xunit.assert.xml create mode 100644 resharper/test/data/Annotations/Annotations.cs create mode 100644 resharper/test/src/tests/AcceptanceTests/Annotations/ExternalAnnotationsProvider.cs create mode 100644 resharper/test/src/tests/AcceptanceTests/Annotations/ExternalAnnotationsTestBase2.cs create mode 100644 resharper/test/src/tests/AcceptanceTests/Annotations/XunitAnnotationsTest.cs diff --git a/resharper/ExternalAnnotations/xunit.assert.xml b/resharper/ExternalAnnotations/xunit.assert.xml new file mode 100644 index 0000000..796c888 --- /dev/null +++ b/resharper/ExternalAnnotations/xunit.assert.xml @@ -0,0 +1,39 @@ + + + + + + + collection:null => halt + + + + + 3 + + + + + + + + + collection:null => halt + + + + + 3 + + + + + + + + diff --git a/resharper/test/data/Annotations/Annotations.cs b/resharper/test/data/Annotations/Annotations.cs new file mode 100644 index 0000000..e72b3e4 --- /dev/null +++ b/resharper/test/data/Annotations/Annotations.cs @@ -0,0 +1,614 @@ +using System; + +#pragma warning disable 1591 +// ReSharper disable UnusedMember.Global +// ReSharper disable UnusedParameter.Local +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedAutoPropertyAccessor.Global +// ReSharper disable IntroduceOptionalParameters.Global +// ReSharper disable MemberCanBeProtected.Global +// ReSharper disable InconsistentNaming + +namespace JetBrains.Annotations +{ + /// + /// Indicates that the value of the marked element could be null sometimes, + /// so the check for null is necessary before its usage + /// + /// + /// [CanBeNull] public object Test() { return null; } + /// public void UseTest() { + /// var p = Test(); + /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException' + /// } + /// + [AttributeUsage( + AttributeTargets.Method | AttributeTargets.Parameter | + AttributeTargets.Property | AttributeTargets.Delegate | + AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public sealed class CanBeNullAttribute : Attribute { } + + /// + /// Indicates that the value of the marked element could never be null + /// + /// + /// [NotNull] public object Foo() { + /// return null; // Warning: Possible 'null' assignment + /// } + /// + [AttributeUsage( + AttributeTargets.Method | AttributeTargets.Parameter | + AttributeTargets.Property | AttributeTargets.Delegate | + AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public sealed class NotNullAttribute : Attribute { } + + /// + /// Indicates that the marked method builds string by format pattern and (optional) arguments. + /// Parameter, which contains format string, should be given in constructor. The format string + /// should be in -like form + /// + /// + /// [StringFormatMethod("message")] + /// public void ShowError(string message, params object[] args) { /* do something */ } + /// public void Foo() { + /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string + /// } + /// + [AttributeUsage( + AttributeTargets.Constructor | AttributeTargets.Method, + AllowMultiple = false, Inherited = true)] + public sealed class StringFormatMethodAttribute : Attribute + { + /// + /// Specifies which parameter of an annotated method should be treated as format-string + /// + public StringFormatMethodAttribute(string formatParameterName) + { + FormatParameterName = formatParameterName; + } + + public string FormatParameterName { get; private set; } + } + + /// + /// Indicates that the function argument should be string literal and match one + /// of the parameters of the caller function. For example, ReSharper annotates + /// the parameter of + /// + /// + /// public void Foo(string param) { + /// if (param == null) + /// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol + /// } + /// + [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)] + public sealed class InvokerParameterNameAttribute : Attribute { } + + /// + /// Indicates that the method is contained in a type that implements + /// interface + /// and this method is used to notify that some property value changed + /// + /// + /// The method should be non-static and conform to one of the supported signatures: + /// + /// NotifyChanged(string) + /// NotifyChanged(params string[]) + /// NotifyChanged{T}(Expression{Func{T}}) + /// NotifyChanged{T,U}(Expression{Func{T,U}}) + /// SetProperty{T}(ref T, T, string) + /// + /// + /// + /// public class Foo : INotifyPropertyChanged { + /// public event PropertyChangedEventHandler PropertyChanged; + /// [NotifyPropertyChangedInvocator] + /// protected virtual void NotifyChanged(string propertyName) { ... } + /// + /// private string _name; + /// public string Name { + /// get { return _name; } + /// set { _name = value; NotifyChanged("LastName"); /* Warning */ } + /// } + /// } + /// + /// Examples of generated notifications: + /// + /// NotifyChanged("Property") + /// NotifyChanged(() => Property) + /// NotifyChanged((VM x) => x.Property) + /// SetProperty(ref myField, value, "Property") + /// + /// + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute + { + public NotifyPropertyChangedInvocatorAttribute() { } + public NotifyPropertyChangedInvocatorAttribute(string parameterName) + { + ParameterName = parameterName; + } + + public string ParameterName { get; private set; } + } + + /// + /// Describes dependency between method input and output + /// + /// + ///

Function Definition Table syntax:

+ /// + /// FDT ::= FDTRow [;FDTRow]* + /// FDTRow ::= Input => Output | Output <= Input + /// Input ::= ParameterName: Value [, Input]* + /// Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value} + /// Value ::= true | false | null | notnull | canbenull + /// + /// If method has single input parameter, it's name could be omitted.
+ /// Using halt (or void/nothing, which is the same) + /// for method output means that the methos doesn't return normally.
+ /// canbenull annotation is only applicable for output parameters.
+ /// You can use multiple [ContractAnnotation] for each FDT row, + /// or use single attribute with rows separated by semicolon.
+ ///
+ /// + /// + /// [ContractAnnotation("=> halt")] + /// public void TerminationMethod() + /// + /// + /// [ContractAnnotation("halt <= condition: false")] + /// public void Assert(bool condition, string text) // regular assertion method + /// + /// + /// [ContractAnnotation("s:null => true")] + /// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty() + /// + /// + /// // A method that returns null if the parameter is null, and not null if the parameter is not null + /// [ContractAnnotation("null => null; notnull => notnull")] + /// public object Transform(object data) + /// + /// + /// [ContractAnnotation("s:null=>false; =>true,result:notnull; =>false, result:null")] + /// public bool TryParse(string s, out Person result) + /// + /// + [AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = true)] + public sealed class ContractAnnotationAttribute : Attribute + { + public ContractAnnotationAttribute([NotNull] string contract) + : this(contract, false) { } + + public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates) + { + Contract = contract; + ForceFullStates = forceFullStates; + } + + public string Contract { get; private set; } + public bool ForceFullStates { get; private set; } + } + + /// + /// Indicates that marked element should be localized or not + /// + /// + /// [LocalizationRequiredAttribute(true)] + /// public class Foo { + /// private string str = "my string"; // Warning: Localizable string + /// } + /// + [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] + public sealed class LocalizationRequiredAttribute : Attribute + { + public LocalizationRequiredAttribute() : this(true) { } + public LocalizationRequiredAttribute(bool required) + { + Required = required; + } + + public bool Required { get; private set; } + } + + /// + /// Indicates that the value of the marked type (or its derivatives) + /// cannot be compared using '==' or '!=' operators and Equals() + /// should be used instead. However, using '==' or '!=' for comparison + /// with null is always permitted. + /// + /// + /// [CannotApplyEqualityOperator] + /// class NoEquality { } + /// class UsesNoEquality { + /// public void Test() { + /// var ca1 = new NoEquality(); + /// var ca2 = new NoEquality(); + /// if (ca1 != null) { // OK + /// bool condition = ca1 == ca2; // Warning + /// } + /// } + /// } + /// + [AttributeUsage( + AttributeTargets.Interface | AttributeTargets.Class | + AttributeTargets.Struct, AllowMultiple = false, Inherited = true)] + public sealed class CannotApplyEqualityOperatorAttribute : Attribute { } + + /// + /// When applied to a target attribute, specifies a requirement for any type marked + /// with the target attribute to implement or inherit specific type or types. + /// + /// + /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement + /// public class ComponentAttribute : Attribute { } + /// [Component] // ComponentAttribute requires implementing IComponent interface + /// public class MyComponent : IComponent { } + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] + [BaseTypeRequired(typeof(Attribute))] + public sealed class BaseTypeRequiredAttribute : Attribute + { + public BaseTypeRequiredAttribute([NotNull] Type baseType) + { + BaseType = baseType; + } + + [NotNull] public Type BaseType { get; private set; } + } + + /// + /// Indicates that the marked symbol is used implicitly + /// (e.g. via reflection, in external library), so this symbol + /// will not be marked as unused (as well as by other usage inspections) + /// + [AttributeUsage(AttributeTargets.All, AllowMultiple = false, Inherited = true)] + public sealed class UsedImplicitlyAttribute : Attribute + { + public UsedImplicitlyAttribute() + : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { } + + public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags) + : this(useKindFlags, ImplicitUseTargetFlags.Default) { } + + public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags) + : this(ImplicitUseKindFlags.Default, targetFlags) { } + + public UsedImplicitlyAttribute( + ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) + { + UseKindFlags = useKindFlags; + TargetFlags = targetFlags; + } + + public ImplicitUseKindFlags UseKindFlags { get; private set; } + public ImplicitUseTargetFlags TargetFlags { get; private set; } + } + + /// + /// Should be used on attributes and causes ReSharper + /// to not mark symbols marked with such attributes as unused + /// (as well as by other usage inspections) + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public sealed class MeansImplicitUseAttribute : Attribute + { + public MeansImplicitUseAttribute() + : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { } + + public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags) + : this(useKindFlags, ImplicitUseTargetFlags.Default) { } + + public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags) + : this(ImplicitUseKindFlags.Default, targetFlags) { } + + public MeansImplicitUseAttribute( + ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) + { + UseKindFlags = useKindFlags; + TargetFlags = targetFlags; + } + + [UsedImplicitly] public ImplicitUseKindFlags UseKindFlags { get; private set; } + [UsedImplicitly] public ImplicitUseTargetFlags TargetFlags { get; private set; } + } + + [Flags] + public enum ImplicitUseKindFlags + { + Default = Access | Assign | InstantiatedWithFixedConstructorSignature, + /// Only entity marked with attribute considered used + Access = 1, + /// Indicates implicit assignment to a member + Assign = 2, + /// + /// Indicates implicit instantiation of a type with fixed constructor signature. + /// That means any unused constructor parameters won't be reported as such. + /// + InstantiatedWithFixedConstructorSignature = 4, + /// Indicates implicit instantiation of a type + InstantiatedNoFixedConstructorSignature = 8, + } + + /// + /// Specify what is considered used implicitly + /// when marked with + /// or + /// + [Flags] + public enum ImplicitUseTargetFlags + { + Default = Itself, + Itself = 1, + /// Members of entity marked with attribute are considered used + Members = 2, + /// Entity marked with attribute and all its members considered used + WithMembers = Itself | Members + } + + /// + /// This attribute is intended to mark publicly available API + /// which should not be removed and so is treated as used + /// + [MeansImplicitUse] + public sealed class PublicAPIAttribute : Attribute + { + public PublicAPIAttribute() { } + public PublicAPIAttribute([NotNull] string comment) + { + Comment = comment; + } + + [NotNull] public string Comment { get; private set; } + } + + /// + /// Tells code analysis engine if the parameter is completely handled + /// when the invoked method is on stack. If the parameter is a delegate, + /// indicates that delegate is executed while the method is executed. + /// If the parameter is an enumerable, indicates that it is enumerated + /// while the method is executed + /// + [AttributeUsage(AttributeTargets.Parameter, Inherited = true)] + public sealed class InstantHandleAttribute : Attribute { } + + /// + /// Indicates that a method does not make any observable state changes. + /// The same as System.Diagnostics.Contracts.PureAttribute + /// + /// + /// [Pure] private int Multiply(int x, int y) { return x * y; } + /// public void Foo() { + /// const int a = 2, b = 2; + /// Multiply(a, b); // Waring: Return value of pure method is not used + /// } + /// + [AttributeUsage(AttributeTargets.Method, Inherited = true)] + public sealed class PureAttribute : Attribute { } + + /// + /// Indicates that a parameter is a path to a file or a folder + /// within a web project. Path can be relative or absolute, + /// starting from web root (~) + /// + [AttributeUsage(AttributeTargets.Parameter)] + public class PathReferenceAttribute : Attribute + { + public PathReferenceAttribute() { } + public PathReferenceAttribute([PathReference] string basePath) + { + BasePath = basePath; + } + + [NotNull] public string BasePath { get; private set; } + } + + // ASP.NET MVC attributes + + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] + public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute + { + public AspMvcAreaMasterLocationFormatAttribute(string format) { } + } + + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] + public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute + { + public AspMvcAreaPartialViewLocationFormatAttribute(string format) { } + } + + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] + public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute + { + public AspMvcAreaViewLocationFormatAttribute(string format) { } + } + + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] + public sealed class AspMvcMasterLocationFormatAttribute : Attribute + { + public AspMvcMasterLocationFormatAttribute(string format) { } + } + + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] + public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute + { + public AspMvcPartialViewLocationFormatAttribute(string format) { } + } + + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] + public sealed class AspMvcViewLocationFormatAttribute : Attribute + { + public AspMvcViewLocationFormatAttribute(string format) { } + } + + /// + /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter + /// is an MVC action. If applied to a method, the MVC action name is calculated + /// implicitly from the context. Use this attribute for custom wrappers similar to + /// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String) + /// + [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] + public sealed class AspMvcActionAttribute : Attribute + { + public AspMvcActionAttribute() { } + public AspMvcActionAttribute([NotNull] string anonymousProperty) + { + AnonymousProperty = anonymousProperty; + } + + [NotNull] public string AnonymousProperty { get; private set; } + } + + /// + /// ASP.NET MVC attribute. Indicates that a parameter is an MVC area. + /// Use this attribute for custom wrappers similar to + /// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String) + /// + [AttributeUsage(AttributeTargets.Parameter)] + public sealed class AspMvcAreaAttribute : PathReferenceAttribute + { + public AspMvcAreaAttribute() { } + public AspMvcAreaAttribute([NotNull] string anonymousProperty) + { + AnonymousProperty = anonymousProperty; + } + + [NotNull] public string AnonymousProperty { get; private set; } + } + + /// + /// ASP.NET MVC attribute. If applied to a parameter, indicates that + /// the parameter is an MVC controller. If applied to a method, + /// the MVC controller name is calculated implicitly from the context. + /// Use this attribute for custom wrappers similar to + /// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String) + /// + [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] + public sealed class AspMvcControllerAttribute : Attribute + { + public AspMvcControllerAttribute() { } + public AspMvcControllerAttribute([NotNull] string anonymousProperty) + { + AnonymousProperty = anonymousProperty; + } + + [NotNull] public string AnonymousProperty { get; private set; } + } + + /// + /// ASP.NET MVC attribute. Indicates that a parameter is an MVC Master. + /// Use this attribute for custom wrappers similar to + /// System.Web.Mvc.Controller.View(String, String) + /// + [AttributeUsage(AttributeTargets.Parameter)] + public sealed class AspMvcMasterAttribute : Attribute { } + + /// + /// ASP.NET MVC attribute. Indicates that a parameter is an MVC model type. + /// Use this attribute for custom wrappers similar to + /// System.Web.Mvc.Controller.View(String, Object) + /// + [AttributeUsage(AttributeTargets.Parameter)] + public sealed class AspMvcModelTypeAttribute : Attribute { } + + /// + /// ASP.NET MVC attribute. If applied to a parameter, indicates that + /// the parameter is an MVC partial view. If applied to a method, + /// the MVC partial view name is calculated implicitly from the context. + /// Use this attribute for custom wrappers similar to + /// System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String) + /// + [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] + public sealed class AspMvcPartialViewAttribute : PathReferenceAttribute { } + + /// + /// ASP.NET MVC attribute. Allows disabling all inspections + /// for MVC views within a class or a method. + /// + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] + public sealed class AspMvcSupressViewErrorAttribute : Attribute { } + + /// + /// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template. + /// Use this attribute for custom wrappers similar to + /// System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String) + /// + [AttributeUsage(AttributeTargets.Parameter)] + public sealed class AspMvcDisplayTemplateAttribute : Attribute { } + + /// + /// ASP.NET MVC attribute. Indicates that a parameter is an MVC editor template. + /// Use this attribute for custom wrappers similar to + /// System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String) + /// + [AttributeUsage(AttributeTargets.Parameter)] + public sealed class AspMvcEditorTemplateAttribute : Attribute { } + + /// + /// ASP.NET MVC attribute. Indicates that a parameter is an MVC template. + /// Use this attribute for custom wrappers similar to + /// System.ComponentModel.DataAnnotations.UIHintAttribute(System.String) + /// + [AttributeUsage(AttributeTargets.Parameter)] + public sealed class AspMvcTemplateAttribute : Attribute { } + + /// + /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter + /// is an MVC view. If applied to a method, the MVC view name is calculated implicitly + /// from the context. Use this attribute for custom wrappers similar to + /// System.Web.Mvc.Controller.View(Object) + /// + [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] + public sealed class AspMvcViewAttribute : PathReferenceAttribute { } + + /// + /// ASP.NET MVC attribute. When applied to a parameter of an attribute, + /// indicates that this parameter is an MVC action name + /// + /// + /// [ActionName("Foo")] + /// public ActionResult Login(string returnUrl) { + /// ViewBag.ReturnUrl = Url.Action("Foo"); // OK + /// return RedirectToAction("Bar"); // Error: Cannot resolve action + /// } + /// + [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)] + public sealed class AspMvcActionSelectorAttribute : Attribute { } + + [AttributeUsage( + AttributeTargets.Parameter | AttributeTargets.Property | + AttributeTargets.Field, Inherited = true)] + public sealed class HtmlElementAttributesAttribute : Attribute + { + public HtmlElementAttributesAttribute() { } + public HtmlElementAttributesAttribute([NotNull] string name) + { + Name = name; + } + + [NotNull] public string Name { get; private set; } + } + + [AttributeUsage( + AttributeTargets.Parameter | AttributeTargets.Field | + AttributeTargets.Property, Inherited = true)] + public sealed class HtmlAttributeValueAttribute : Attribute + { + public HtmlAttributeValueAttribute([NotNull] string name) + { + Name = name; + } + + [NotNull] public string Name { get; private set; } + } + + // Razor attributes + + /// + /// Razor attribute. Indicates that a parameter or a method is a Razor section. + /// Use this attribute for custom wrappers similar to + /// System.Web.WebPages.WebPageBase.RenderSection(String) + /// + [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, Inherited = true)] + public sealed class RazorSectionAttribute : Attribute { } +} diff --git a/resharper/test/src/tests/AcceptanceTests/Annotations/ExternalAnnotationsProvider.cs b/resharper/test/src/tests/AcceptanceTests/Annotations/ExternalAnnotationsProvider.cs new file mode 100644 index 0000000..ae5b7d5 --- /dev/null +++ b/resharper/test/src/tests/AcceptanceTests/Annotations/ExternalAnnotationsProvider.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using JetBrains.Application; +using JetBrains.Metadata.Utils; +using JetBrains.ReSharper.Psi.Impl.Reflection2.ExternalAnnotations; +using JetBrains.Util; + +namespace XunitContrib.Runner.ReSharper.Tests.AcceptanceTests.Annotations +{ + [ShellComponent] + public class ExternalAnnotationsProvider : IExternalAnnotationsFileProvider + { + private readonly OneToSetMap annotations; + private FileSystemPath cachedBaseTestDataPath; + + public ExternalAnnotationsProvider() + { + var location = TestDataPath2; + annotations = new OneToSetMap(StringComparer.OrdinalIgnoreCase); + + foreach (var file in location.GetChildFiles("*.xml")) + annotations.Add(file.NameWithoutExtension, file); + foreach (var directory in location.GetChildDirectories()) + { + foreach (var file in directory.GetChildFiles("*.xml", PathSearchFlags.RecurseIntoSubdirectories)) + { + annotations.Add(file.NameWithoutExtension, file); + annotations.Add(file.Directory.Name, file); + } + } + } + + public IEnumerable GetAnnotationsFiles(AssemblyNameInfo assemblyName = null, FileSystemPath assemblyLocation = null) + { + if (assemblyName == null) + return annotations.Values; + return annotations[assemblyName.Name]; + } + + private FileSystemPath BaseTestDataPath + { + get + { + if (cachedBaseTestDataPath == null) + cachedBaseTestDataPath = TestUtil.GetTestDataPathBase(GetType().Assembly); + return cachedBaseTestDataPath; + } + } + + private string RelativeTestDataPath + { + get { return @"..\..\ExternalAnnotations"; } + } + + private FileSystemPath TestDataPath2 + { + get { return BaseTestDataPath.Combine(RelativeTestDataPath); } + } + } +} \ No newline at end of file diff --git a/resharper/test/src/tests/AcceptanceTests/Annotations/ExternalAnnotationsTestBase2.cs b/resharper/test/src/tests/AcceptanceTests/Annotations/ExternalAnnotationsTestBase2.cs new file mode 100644 index 0000000..abf01f3 --- /dev/null +++ b/resharper/test/src/tests/AcceptanceTests/Annotations/ExternalAnnotationsTestBase2.cs @@ -0,0 +1,123 @@ +using System; +using System.Linq; +using JetBrains.Annotations; +using JetBrains.ProjectModel; +using JetBrains.ReSharper.Psi; +using JetBrains.ReSharper.Psi.CodeAnnotations; +using JetBrains.ReSharper.Psi.Modules; +using JetBrains.ReSharper.Psi.Util; +using JetBrains.ReSharper.TestFramework; +using JetBrains.Util; +using NUnit.Framework; + +namespace XunitContrib.Runner.ReSharper.Tests.AcceptanceTests.Annotations +{ + public abstract class ExternalAnnotationsTestBase2 : BaseTestWithSingleProject + { + protected void AssertHelper(string xmlDocId, Action assert) + { + WithSingleProject(EmptyList.InstanceList, (lifetime, solution, project) => RunGuarded(() => + { + var psiModule = solution.PsiModules().GetPrimaryPsiModule(project); + var psiServices = solution.GetPsiServices(); + + var declaredElement = XMLDocUtil.ResolveId(psiServices, xmlDocId, psiModule, true, + project.GetResolveContext()); + Assert.NotNull(declaredElement, "Declared element cannot be resolved from XML Doc ID {0}", xmlDocId); + + var annotationsCache = psiServices.GetCodeAnnotationsCache(); + + assert(annotationsCache, declaredElement); + })); + } + + protected IParameter GetParameter(string xmlDocId, IDeclaredElement element, string parameterName) + { + var parametersOwner = element as IParametersOwner; + Assert.NotNull(parametersOwner, "Declared element is not an IParametersOwner {0}", xmlDocId); + + var parameter = parametersOwner.Parameters.SingleOrDefault(p => p.ShortName == parameterName); + Assert.NotNull(parameter, "Parameter \"{0}\" is not found on {1}", parameterName, xmlDocId); + + return parameter; + } + + protected void AssertParameterAssertCondition(string xmlDocId, string parameterName, + AssertionConditionType conditionType) + { + AssertHelper(xmlDocId, (cache, element) => + { + var parameter = GetParameter(xmlDocId, element, parameterName); + + var actual = cache.GetParameterAssertionCondition(parameter); + Assert.AreEqual(conditionType, actual); + }); + } + + protected void AssertParameterCanBeNull(string xmlDocId, string parameterName) + { + AssertParameterNullableValue(xmlDocId, parameterName, CodeAnnotationNullableValue.NOT_NULL); + } + + protected void AssertParameterIsNotNull(string xmlDocId, string parameterName) + { + AssertParameterNullableValue(xmlDocId, parameterName, CodeAnnotationNullableValue.NOT_NULL); + } + + private void AssertParameterNullableValue(string xmlDocId, string parameterName, CodeAnnotationNullableValue? expected) + { + AssertHelper(xmlDocId, (cache, element) => + { + var parameter = GetParameter(xmlDocId, element, parameterName); + + var actual = cache.GetNullableAttribute(parameter); + Assert.AreEqual(expected, actual); + }); + } + + protected void AssertIsMeansImplicitUseAttribute(string xmlDocId) + { + AssertHelper(xmlDocId, (cache, element) => + { + var attributesOwner = element as IAttributesOwner; + Assert.NotNull(attributesOwner, "Declared element is not an IAttributesOwner {0}", xmlDocId); + + var attributeInstances = attributesOwner.GetAttributeInstances(false); + foreach (var attributeInstance in attributeInstances) + { + ImplicitUseKindFlags kindFlags; + ImplicitUseTargetFlags targetFlags; + if (cache.IsMeansImplicitUse(attributeInstance, out kindFlags, out targetFlags)) + return; + } + + Assert.Fail("Declared element is not marked as implicit use {0}", xmlDocId); + }); + } + + protected void AssertIsAssertionMethod(string xmlDocId) + { + AssertHelper(xmlDocId, (cache, element) => + { + var method = element as IMethod; + Assert.NotNull(method, "Declared element is not an IMethod {0}", xmlDocId); + + Assert.True(cache.IsAssertionMethod(method)); + }); + } + + protected void AssertParameterIsInstantHandle(string xmlDocId, string parameterName) + { + AssertHelper(xmlDocId, (cache, element) => + { + var parametersOwner = element as IParametersOwner; + Assert.NotNull(parametersOwner, "Declared element is not an IParametersOwner {0}", xmlDocId); + + var parameter = parametersOwner.Parameters.SingleOrDefault(p => p.ShortName == parameterName); + Assert.NotNull(parameter, "Parameter \"{0}\" is not found on {1}", parameterName, xmlDocId); + + Assert.True(cache.GetInstantHandle(parameter)); + }); + } + } +} \ No newline at end of file diff --git a/resharper/test/src/tests/AcceptanceTests/Annotations/XunitAnnotationsTest.cs b/resharper/test/src/tests/AcceptanceTests/Annotations/XunitAnnotationsTest.cs new file mode 100644 index 0000000..a1f87c1 --- /dev/null +++ b/resharper/test/src/tests/AcceptanceTests/Annotations/XunitAnnotationsTest.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using JetBrains.Annotations; +using JetBrains.ReSharper.TestFramework; +using NUnit.Framework; + +namespace XunitContrib.Runner.ReSharper.Tests.AcceptanceTests.Annotations +{ + [Category("External annotations")] + public abstract class XunitAnnotationsTest : ExternalAnnotationsTestBase2 + { + public override void SetUp() + { + base.SetUp(); + + EnvironmentVariables.SetUp(BaseTestDataPath); + } + + protected override IEnumerable GetReferencedAssemblies() + { + return base.GetReferencedAssemblies().Select(a => + { + if (!Path.IsPathRooted(a)) + return Environment.ExpandEnvironmentVariables(EnvironmentVariables.XUNIT_ASSEMBLIES + a); + return a; + }); + } + + [Test] + public void Should_mark_fact_as_means_implicit_use() + { + AssertIsMeansImplicitUseAttribute("T:Xunit.FactAttribute"); + } + +#region Assert.Contains + + private const string AssertContainsXmlDocId = + "M:Xunit.Assert.Contains``1(``0,System.Collections.Generic.IEnumerable{``0})"; + + private const string AssertContainsWithComparerXmlDocId = + "M:Xunit.Assert.Contains``1(``0,System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEqualityComparer{``0})"; + + [Test] + public void Should_mark_assert_contains_as_assertion_method() + { + AssertIsAssertionMethod(AssertContainsXmlDocId); + AssertIsAssertionMethod(AssertContainsWithComparerXmlDocId); + } + + [Test] + public void Should_mark_assert_contains_collection_parameter_as_instant_handle() + { + AssertParameterIsInstantHandle(AssertContainsXmlDocId, "collection"); + AssertParameterIsInstantHandle(AssertContainsWithComparerXmlDocId, "collection"); + } + + [Test] + public void Should_mark_assert_contains_collection_parameter_with_not_null_assert() + { + AssertParameterAssertCondition(AssertContainsXmlDocId, "collection", AssertionConditionType.IS_NOT_NULL); + AssertParameterAssertCondition(AssertContainsWithComparerXmlDocId, "collection", AssertionConditionType.IS_NOT_NULL); + } + + [Test] + public void Should_mark_comparer_as_not_null_assert() + { + AssertParameterIsNotNull(AssertContainsWithComparerXmlDocId, "comparer"); + } + + // TODO: Contract annotation asserts + //AssertHelper(xmlDocId, + // (cache, element) => + // { + // var method = element as IMethod; + // Assert.NotNull(method, "Declared element is not an IMethod {0}", xmlDocId); + // var contract = cache.GetContractAnnotation(method); + + // Assert.NotNull(contract); + // contract.Rows.First(). + // }); + +#endregion + + #region Assert.Contains with comparer + #endregion + } + + [Category("xunit1")] + [TestReferences(@"xunit191\xunit.dll", @"xunit191\xunit.extensions.dll")] + public class Xunit1AnnotationsTest : XunitAnnotationsTest + { + [Test] + public void Should_mark_theory_attribute_as_means_implicit_use_due_to_inheritance() + { + AssertIsMeansImplicitUseAttribute("T:Xunit.Extensions.TheoryAttribute"); + } + } + + [Category("xunit2")] + [TestReferences(@"xunit2\xunit.abstractions.dll", @"xunit2\xunit.assert.dll", + @"xunit2\xunit.core.dll", @"xunit2\xunit.execution.dll")] + public class Xunit2AnnotationsTest : XunitAnnotationsTest + { + [Test] + public void Should_mark_theory_attribute_as_means_implicit_use_due_to_inheritance() + { + AssertIsMeansImplicitUseAttribute("T:Xunit.TheoryAttribute"); + } + } +} \ No newline at end of file diff --git a/resharper/test/src/tests/AcceptanceTests/EnvironmentVariables.cs b/resharper/test/src/tests/AcceptanceTests/EnvironmentVariables.cs index 0daa8c9..7ade6f1 100644 --- a/resharper/test/src/tests/AcceptanceTests/EnvironmentVariables.cs +++ b/resharper/test/src/tests/AcceptanceTests/EnvironmentVariables.cs @@ -14,7 +14,7 @@ public static void SetUp(FileSystemPath baseDataPath) { var assembliesPath = baseDataPath.Directory.Combine("lib"); Environment.SetEnvironmentVariable(XUNIT_ASSEMBLIES_ENV_VAR, - assembliesPath.FullPath, EnvironmentVariableTarget.Process); + assembliesPath.FullPath + @"\", EnvironmentVariableTarget.Process); } public static string XunitAssembliesPath diff --git a/resharper/test/src/tests/tests-rs82.csproj b/resharper/test/src/tests/tests-rs82.csproj index c28997e..a826399 100644 --- a/resharper/test/src/tests/tests-rs82.csproj +++ b/resharper/test/src/tests/tests-rs82.csproj @@ -29,6 +29,7 @@ prompt 4 false + false pdbonly @@ -56,6 +57,9 @@ + + + @@ -125,4 +129,7 @@ PreserveNewest + + copy $(ReSharperSdkBinaries)\JetBrains.Annotations.dll $(TargetDir) + \ No newline at end of file diff --git a/resharper/xunitcontrib-resharper8.2.sln b/resharper/xunitcontrib-resharper8.2.sln index 96efdbe..05edef2 100644 --- a/resharper/xunitcontrib-resharper8.2.sln +++ b/resharper/xunitcontrib-resharper8.2.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30110.0 +VisualStudioVersion = 12.0.30501.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xunitcontrib.runner.resharper.runner.8.2", "src\xunitcontrib.runner.resharper.runner\xunitcontrib.runner.resharper.runner.8.2.csproj", "{65DED109-21E4-48B6-BDC4-FAA188EF621D}" EndProject @@ -9,6 +9,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xunitcontrib.runner.resharp EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests-rs82", "test\src\tests\tests-rs82.csproj", "{CB4405FD-A0DC-40CD-951A-C866DC050886}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{09FE9BA0-0309-48CF-AA39-298A26C4BDBD}" + ProjectSection(SolutionItems) = preProject + ExternalAnnotations\xunit.assert.xml = ExternalAnnotations\xunit.assert.xml + ExternalAnnotations\xunit.xml = ExternalAnnotations\xunit.xml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU From 8413813cf22a820eb20978413ec939fa6ea8e712 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Tue, 7 Apr 2015 22:55:49 +0100 Subject: [PATCH 02/24] Work in progress on annotations --- .../ExternalAnnotations/xunit.assert.xml | 494 +++++++++++++++++- resharper/xunitcontrib-resharper.sln | 1 + 2 files changed, 476 insertions(+), 19 deletions(-) diff --git a/resharper/ExternalAnnotations/xunit.assert.xml b/resharper/ExternalAnnotations/xunit.assert.xml index 796c888..51c426e 100644 --- a/resharper/ExternalAnnotations/xunit.assert.xml +++ b/resharper/ExternalAnnotations/xunit.assert.xml @@ -1,39 +1,495 @@ - - - + + + + + condition:false => halt + + + IS_FALSE + + + + + + + condition:false => halt + + + IS_FALSE + + + + + + + condition:false => halt + + + IS_FALSE + + + + + + + condition:false => halt + + + IS_FALSE + + + + + - collection:null => halt + condition:true => halt + + IS_TRUE + + + + + + + condition:true => halt + + + IS_TRUE + + + + + + + condition:true => halt + + + IS_TRUE + + + + + + + condition:true => halt + + + IS_TRUE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + object:null => halt + + - 3 + IS_NOT_NULL - - - + + - collection:null => halt + object:notnull => halt - - + - 3 + IS_NULL + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + actual:null =gt; halt + + + + + + + IS_NOT_NULL + + + + + + + + actual:null =gt; halt + + + + + + + IS_NOT_NULL + + + + + + + + actual:null => halt + + + + + + + IS_NOT_NULL + + + + + + + + actual:null => halt + + + + + + + IS_NOT_NULL + + + + + + + + + + + + + object:null => halt + + + + IS_NOT_NULL + + + + + + + + object:null => halt + + + + + + + IS_NOT_NULL + + + + + + + + object:null => halt + + + + IS_NOT_NULL + + + + + + + + object:null => halt + + + + + + + IS_NOT_NULL + + + + + + + + + + object:null => halt + + + + IS_NOT_NULL + + + + + + + + object:null => halt + + + + + + + IS_NOT_NULL + + + diff --git a/resharper/xunitcontrib-resharper.sln b/resharper/xunitcontrib-resharper.sln index f7c75f6..7ba8b9b 100644 --- a/resharper/xunitcontrib-resharper.sln +++ b/resharper/xunitcontrib-resharper.sln @@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ReSharper", "ReSharper", "{ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External Annotations", "External Annotations", "{B5E17072-61C6-4282-8B7F-AFD468A84194}" ProjectSection(SolutionItems) = preProject + ExternalAnnotations\xunit.assert.xml = ExternalAnnotations\xunit.assert.xml ExternalAnnotations\xunit.xml = ExternalAnnotations\xunit.xml EndProjectSection EndProject From 8316dc335ad698b2e1a13b0e4857ce9ab0a05d37 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Fri, 10 Apr 2015 17:39:44 +0100 Subject: [PATCH 03/24] Completed xunit.assert annotations --- .../ExternalAnnotations/xunit.assert.xml | 287 +++++++++++++++++- 1 file changed, 282 insertions(+), 5 deletions(-) diff --git a/resharper/ExternalAnnotations/xunit.assert.xml b/resharper/ExternalAnnotations/xunit.assert.xml index 51c426e..2b5617c 100644 --- a/resharper/ExternalAnnotations/xunit.assert.xml +++ b/resharper/ExternalAnnotations/xunit.assert.xml @@ -263,9 +263,167 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -348,7 +506,7 @@ - actual:null =gt; halt + actual:null => halt @@ -363,7 +521,7 @@ - actual:null =gt; halt + actual:null => halt @@ -405,8 +563,127 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From d3069723acda1e46ef1870c97312262945da6a8f Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Fri, 10 Apr 2015 17:39:52 +0100 Subject: [PATCH 04/24] Added xunit.core annotations --- resharper/ExternalAnnotations/xunit.core.xml | 109 +++++++++++++++++++ resharper/xunitcontrib-resharper.sln | 1 + 2 files changed, 110 insertions(+) create mode 100644 resharper/ExternalAnnotations/xunit.core.xml diff --git a/resharper/ExternalAnnotations/xunit.core.xml b/resharper/ExternalAnnotations/xunit.core.xml new file mode 100644 index 0000000..3f1134f --- /dev/null +++ b/resharper/ExternalAnnotations/xunit.core.xml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + argValue:null => halt + + + + + + + + IS_NOT_NULL + + + + + + + + argValue:null => halt + + + + + + + + + IS_NOT_NULL + + + + + + + + + test:false => halt + + + + + + + + + + + IS_TRUE + + + + \ No newline at end of file diff --git a/resharper/xunitcontrib-resharper.sln b/resharper/xunitcontrib-resharper.sln index 7ba8b9b..62a751d 100644 --- a/resharper/xunitcontrib-resharper.sln +++ b/resharper/xunitcontrib-resharper.sln @@ -15,6 +15,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External Annotations", "External Annotations", "{B5E17072-61C6-4282-8B7F-AFD468A84194}" ProjectSection(SolutionItems) = preProject ExternalAnnotations\xunit.assert.xml = ExternalAnnotations\xunit.assert.xml + ExternalAnnotations\xunit.core.xml = ExternalAnnotations\xunit.core.xml ExternalAnnotations\xunit.xml = ExternalAnnotations\xunit.xml EndProjectSection EndProject From 3dc4f28dcec0027965b18f521aa289f74dc5b479 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Fri, 10 Apr 2015 18:11:45 +0100 Subject: [PATCH 05/24] Disable some dodgy annotation tests --- .../Annotations/XunitAnnotationsTest.cs | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/resharper/test/src/tests/AcceptanceTests/Annotations/XunitAnnotationsTest.cs b/resharper/test/src/tests/AcceptanceTests/Annotations/XunitAnnotationsTest.cs index a1f87c1..8fb8336 100644 --- a/resharper/test/src/tests/AcceptanceTests/Annotations/XunitAnnotationsTest.cs +++ b/resharper/test/src/tests/AcceptanceTests/Annotations/XunitAnnotationsTest.cs @@ -43,12 +43,14 @@ public void Should_mark_fact_as_means_implicit_use() private const string AssertContainsWithComparerXmlDocId = "M:Xunit.Assert.Contains``1(``0,System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEqualityComparer{``0})"; - [Test] - public void Should_mark_assert_contains_as_assertion_method() - { - AssertIsAssertionMethod(AssertContainsXmlDocId); - AssertIsAssertionMethod(AssertContainsWithComparerXmlDocId); - } + // Don't think it should be marked as an assertion method. It's not asserting that anything is null + // it'll just NRE if the parameter is null. It's an assertion method, but it's not one we can model + //[Test] + //public void Should_mark_assert_contains_as_assertion_method() + //{ + // AssertIsAssertionMethod(AssertContainsXmlDocId); + // AssertIsAssertionMethod(AssertContainsWithComparerXmlDocId); + //} [Test] public void Should_mark_assert_contains_collection_parameter_as_instant_handle() @@ -57,12 +59,12 @@ public void Should_mark_assert_contains_collection_parameter_as_instant_handle() AssertParameterIsInstantHandle(AssertContainsWithComparerXmlDocId, "collection"); } - [Test] - public void Should_mark_assert_contains_collection_parameter_with_not_null_assert() - { - AssertParameterAssertCondition(AssertContainsXmlDocId, "collection", AssertionConditionType.IS_NOT_NULL); - AssertParameterAssertCondition(AssertContainsWithComparerXmlDocId, "collection", AssertionConditionType.IS_NOT_NULL); - } + //[Test] + //public void Should_mark_assert_contains_collection_parameter_with_not_null_assert() + //{ + // AssertParameterAssertCondition(AssertContainsXmlDocId, "collection", AssertionConditionType.IS_NOT_NULL); + // AssertParameterAssertCondition(AssertContainsWithComparerXmlDocId, "collection", AssertionConditionType.IS_NOT_NULL); + //} [Test] public void Should_mark_comparer_as_not_null_assert() From 893d91ca52816eb1ea8f16c35a4825a51129dfaa Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Fri, 10 Apr 2015 18:11:57 +0100 Subject: [PATCH 06/24] Updated nuspec for ReSharper 9.0 --- resharper/CommonAssemblyInfo.cs | 2 +- resharper/nuget/xunitcontrib-rs9.nuspec | 36 +++++++++---------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/resharper/CommonAssemblyInfo.cs b/resharper/CommonAssemblyInfo.cs index cdf9cb1..312702a 100644 --- a/resharper/CommonAssemblyInfo.cs +++ b/resharper/CommonAssemblyInfo.cs @@ -6,4 +6,4 @@ [assembly : AssemblyDescription("xUnit.net unit test provider for " + ProductInfo.Product)] [assembly : AssemblyCopyright("Copyright (C) Matt Ellis")] [assembly : ComVisible(false)] -[assembly : AssemblyVersion("2.0.0.*")] \ No newline at end of file +[assembly : AssemblyVersion("2.0.6.*")] \ No newline at end of file diff --git a/resharper/nuget/xunitcontrib-rs9.nuspec b/resharper/nuget/xunitcontrib-rs9.nuspec index 6419729..f34950d 100644 --- a/resharper/nuget/xunitcontrib-rs9.nuspec +++ b/resharper/nuget/xunitcontrib-rs9.nuspec @@ -3,45 +3,29 @@ CitizenMatt.Xunit xUnit.net Test Support for ReSharper 9 - 2.0.6-alpha-20150318 + 2.0.6 Matt Ellis Matt Ellis A unit test provider for xUnit.net. Discovers and runs xUnit.net 1.x and 2.0 tests. Includes annotations to aid ReSharper inspections and Live Templates to speed up inserting test methods and asserts. A unit test provider for xUnit.net - -• Added logging for ReSharper 9.0 + Support for xunit 2.0 +• Rewritten the core runner to be more robust with multi-threading. Should fix issues with aborted or inconclusive tests (#44, #31) +• Updated external annotations for xunit 2.0 (#30) +• Read xunit 2.0 settings from config file (#40) +• Added logging for ReSharper 9 in internal mode -From 2.0.5: -• Support for xunit 2.0 RTM. - -From 2.0.4: -• Support for RC4 (build 2924) - -From 2.0.3: -• Support for RC3 (build 2880) -• Support for xunit's appSettings config +From previous builds: • Report diagnostic messages when 'xunit.diagnosticMessages' is set in config (#28) - -From 2.0.2: -• Support for RC1 (build 2826) • Report mismatched pre-release versions on failure (#23) -• Improved compatibility with ReSharper 9 • Fixed crash working with xUnit.net 1.1 - -From 2.0.1: • Fixed an issue (#9) to run individual methods, rather than all methods in the class • Fixed an issue (#21) with Unicode characters in display names and data attributes - -From 2.0.0: -• Beta 5 support (build 2785) • Captures output from ITestOutputHelper • Shadow copy cache clean up on abort • Parallelisation re-enabled! Known issues: -• REQUIRES xunit 2.0 RTM. Will NOT run earlier pre-release versions -• External annotations not yet implemented for xunit2 (to be fixed) -• Live Templates for Theory use xunit1 namespace (to be fixed) +• Live Templates for Theory use xunit1 namespace https://github.com/xunit/resharper-xunit https://raw.githubusercontent.com/xunit/resharper-xunit/xunit2/license.txt https://raw.githubusercontent.com/xunit/media/master/logo-512-transparent.png @@ -70,5 +54,9 @@ Known issues: target="DotFiles\Extensions\CitizenMatt.Xunit\settings\templates.dotSettings" /> + + From a8fed674c4ac62e0c35b29e3ffd61f035b276f27 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Fri, 10 Apr 2015 18:17:35 +0100 Subject: [PATCH 07/24] Preparing release for 2.1.6 Resolves #45, #44, #32, #43, #41, #30 --- resharper/nuget/pack-rs91.bat | 1 + resharper/nuget/xunitcontrib-rs91.nuspec | 63 ++++++++++++++++++++++++ resharper/nuget/xunitcontrib.nuspec | 24 ++++----- 3 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 resharper/nuget/pack-rs91.bat create mode 100644 resharper/nuget/xunitcontrib-rs91.nuspec diff --git a/resharper/nuget/pack-rs91.bat b/resharper/nuget/pack-rs91.bat new file mode 100644 index 0000000..a8cc82e --- /dev/null +++ b/resharper/nuget/pack-rs91.bat @@ -0,0 +1 @@ +nuget pack xunitcontrib-rs91.nuspec diff --git a/resharper/nuget/xunitcontrib-rs91.nuspec b/resharper/nuget/xunitcontrib-rs91.nuspec new file mode 100644 index 0000000..af372a9 --- /dev/null +++ b/resharper/nuget/xunitcontrib-rs91.nuspec @@ -0,0 +1,63 @@ + + + + CitizenMatt.Xunit + xUnit.net Test Support for ReSharper 9 + 2.1.6 + Matt Ellis + Matt Ellis + A unit test provider for xUnit.net. Discovers and runs xUnit.net 1.x and 2.0 tests. Includes annotations to aid ReSharper inspections and Live Templates to speed up inserting test methods and asserts. + A unit test provider for xUnit.net + Support for xunit 2.0 +• Support for ReSharper 9.1 +• Rewritten the core runner to be more robust with multi-threading. Should fix issues with aborted or inconclusive tests (#44, #31) +• Updated external annotations for xunit 2.0 (#30) +• Read xunit 2.0 settings from config file (#40) +• Added logging for ReSharper 9 in internal mode + +From previous builds: +• Report diagnostic messages when 'xunit.diagnosticMessages' is set in config (#28) +• Report mismatched pre-release versions on failure (#23) +• Fixed crash working with xUnit.net 1.1 +• Fixed an issue (#9) to run individual methods, rather than all methods in the class +• Fixed an issue (#21) with Unicode characters in display names and data attributes +• Captures output from ITestOutputHelper +• Shadow copy cache clean up on abort +• Parallelisation re-enabled! + +Known issues: +• Live Templates for Theory use xunit1 namespace + https://github.com/xunit/resharper-xunit + https://raw.githubusercontent.com/xunit/resharper-xunit/xunit2/license.txt + https://raw.githubusercontent.com/xunit/media/master/logo-512-transparent.png + Copyright 2014 Matt Ellis + false + + + + resharper unittest xunit + + + + + + + + + + + + + + + + diff --git a/resharper/nuget/xunitcontrib.nuspec b/resharper/nuget/xunitcontrib.nuspec index 2fd75be..1e1abf9 100644 --- a/resharper/nuget/xunitcontrib.nuspec +++ b/resharper/nuget/xunitcontrib.nuspec @@ -3,36 +3,28 @@ xunitcontrib xUnit.net Test Support - 2.0.5 + 2.1.6 Matt Ellis Matt Ellis A unit test provider for xUnit.net. Discovers and runs xUnit.net 1.x and 2.0 tests. Includes annotations to aid ReSharper inspections and Live Templates to speed up inserting test methods and asserts A unit test provider for xUnit.net Support for xunit 2.0 - -From 2.0.4: -• Support for RC4 (build 2924) - -From 2.0.3: -• Support for RC3 (build 2880) -• Support for xunit's appSettings config -• Report diagnostic messages when 'xunit.diagnosticMessages' is set in config (#28) +• Rewritten the core runner to be more robust with multi-threading. Should fix issues with aborted or inconclusive tests (#44, #31) +• Updated external annotations for xunit 2.0 (#30) +• Read xunit 2.0 settings from config file (#40) From previous builds: -• Support for RC1 (build 2826) +• Report diagnostic messages when 'xunit.diagnosticMessages' is set in config (#28) • Report mismatched pre-release versions on failure (#23) • Fixed crash working with xUnit.net 1.1 • Fixed an issue (#9) to run individual methods, rather than all methods in the class • Fixed an issue (#21) with Unicode characters in display names and data attributes -• Beta 5 support (build 2785) • Captures output from ITestOutputHelper • Shadow copy cache clean up on abort • Parallelisation re-enabled! Known issues: -• REQUIRES xunit 2.0 RTM. Will NOT run earlier pre-release versions -• External annotations not yet implemented for xunit2 (to be fixed) -• Live Templates for Theory use xunit1 namespace (to be fixed) +• Live Templates for Theory use xunit1 namespace https://github.com/xunit/resharper-xunit https://raw.githubusercontent.com/xunit/resharper-xunit/xunit2/license.txt https://raw.githubusercontent.com/xunit/media/master/logo-512-transparent.png @@ -61,5 +53,9 @@ Known issues: target="ReSharper\vAny\settings" /> + + From ebfa811835e32935387e28f9040d52fd6562a465 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Fri, 10 Apr 2015 18:20:45 +0100 Subject: [PATCH 08/24] Updating readme --- readme.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/readme.md b/readme.md index e87e490..0ed6379 100644 --- a/readme.md +++ b/readme.md @@ -6,7 +6,7 @@ This plugin for ReSharper adds support for xUnit.net tests. It supports the foll * Discovery and execution of `[Fact]` and `[Theory]` based tests from source code, or compiled assemblies (e.g. F# projects can run tests, although tests aren't found in the source editor) * External annotations to provide hints to ReSharper that test methods are being implicitly used, and that assert methods check for null, etc. * Live Templates to easily create asserts, test methods, etc. -* Support for ReSharper 8.2 and 9.0. +* Support for ReSharper 8.2 and 9.1. ReSharper 9.0 support is still available from the Extension Manager, but is no longer being maintained. Please upgrade to 9.1 Previously hosted on CodePlex as the [xunitcontrib](http://xunitcontrib.codeplex.com) project. @@ -19,7 +19,6 @@ The plugin can be installed from ReSharper's Extension Manager. Both xUnit.net 1.x and 2.0 are fully supported when running tests, however, the 2.0 support has the following limitations in the editor: * Test discovery is still based on 1.x. That means it will only find tests that are marked with `[Fact]` or other attributes that derive from `FactAttribute` (this includes `[Theory]`). Custom test discovery is not yet supported. -* External annotations have not yet been implemented for xUnit.net 2.0, meaning ReSharper doesn't know that asserts will terminate the method, and can give warnings such as possible null reference exception, even after `Assert.NotNull`. * The Live Templates are still based on 1.x. The biggest problem here is that `[Theory]` is in the wrong namespace. * There is no code completion for `[MemberData]` has not yet been implemented. xUnit.net 1.x's `[PropertyData]` is still supported. From 3d2bfa6a4d42c3c4957aab8498a6b11b7366c53a Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Mon, 27 Apr 2015 16:38:55 +0100 Subject: [PATCH 09/24] Defensive coding if exception data is wonky The xunit runner utility can produce false positives when parsing multiple nested exceptions. Fixed in 2.1, but this adds some defensive coding to at least not throw exceptions and fail to finish running the tests (the message we display might be a bit rubbish though). Fixes #50 --- resharper/src/runner/AbstractionExtensions.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/resharper/src/runner/AbstractionExtensions.cs b/resharper/src/runner/AbstractionExtensions.cs index ecd90c1..cefa4b4 100644 --- a/resharper/src/runner/AbstractionExtensions.cs +++ b/resharper/src/runner/AbstractionExtensions.cs @@ -15,21 +15,26 @@ public static TaskException[] ConvertExceptions(this IFailureInformation failure for (var i = 0; i < failure.ExceptionTypes.Length; i++) { + // There's a bug in 2.0 that parses an exception incorrectly, so let's do this defensively + var type = failure.ExceptionTypes.Length > i ? failure.ExceptionTypes[i] : string.Empty; + // Strip out the xunit assert methods from the stack traces by taking // out anything in the Xunit.Assert namespace - var stackTraces = failure.StackTraces[i] != null ? failure.StackTraces[i] + var stackTraces = (failure.StackTraces.Length > i && failure.StackTraces[i] != null) ? failure.StackTraces[i] .Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries) .Where(s => !s.Contains("Xunit.Assert")).Join(Environment.NewLine) : string.Empty; - exceptions.Add(new TaskException(failure.ExceptionTypes[i], failure.Messages[i], stackTraces)); + var message = failure.Messages.Length > i ? failure.Messages[i] : string.Empty; + + exceptions.Add(new TaskException(type, message, stackTraces)); } // Simplified message - if it's an xunit native exception (most likely an assert) // only include the exception message, otherwise include the exception type - var exceptionMessage = failure.Messages[0]; - var exceptionType = failure.ExceptionTypes[0]; - exceptionType = exceptionType.StartsWith("Xunit") ? string.Empty : (exceptionType + ": "); - simplifiedMessage = exceptionMessage.StartsWith(failure.ExceptionTypes[0]) ? exceptionMessage : exceptionType + exceptionMessage; + var exceptionMessage = failure.Messages.Length > 0 ? failure.Messages[0] : ""; + var safeExceptionType = failure.ExceptionTypes.Length > 0 ? failure.ExceptionTypes[0] : ""; + var exceptionType = safeExceptionType.StartsWith("Xunit") ? string.Empty : (safeExceptionType + ": "); + simplifiedMessage = exceptionMessage.StartsWith(safeExceptionType) ? exceptionMessage : exceptionType + exceptionMessage; return exceptions.ToArray(); } From a16b58d620f2ebd8edb20867dc79fd4ddf87a91c Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Mon, 27 Apr 2015 16:42:33 +0100 Subject: [PATCH 10/24] Bumped versions for 8.2 and 9.1 support Time to drop 9.0... --- resharper/nuget/xunitcontrib-rs91.nuspec | 9 +++++---- resharper/nuget/xunitcontrib.nuspec | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/resharper/nuget/xunitcontrib-rs91.nuspec b/resharper/nuget/xunitcontrib-rs91.nuspec index af372a9..d6013fb 100644 --- a/resharper/nuget/xunitcontrib-rs91.nuspec +++ b/resharper/nuget/xunitcontrib-rs91.nuspec @@ -3,19 +3,20 @@ CitizenMatt.Xunit xUnit.net Test Support for ReSharper 9 - 2.1.6 + 2.1.7 Matt Ellis Matt Ellis A unit test provider for xUnit.net. Discovers and runs xUnit.net 1.x and 2.0 tests. Includes annotations to aid ReSharper inspections and Live Templates to speed up inserting test methods and asserts. A unit test provider for xUnit.net - Support for xunit 2.0 + Don't crash if we get badly formatted exception data from xunit1 (#50) + +From previous builds: • Support for ReSharper 9.1 +• Support for xunit 2.0 • Rewritten the core runner to be more robust with multi-threading. Should fix issues with aborted or inconclusive tests (#44, #31) • Updated external annotations for xunit 2.0 (#30) • Read xunit 2.0 settings from config file (#40) • Added logging for ReSharper 9 in internal mode - -From previous builds: • Report diagnostic messages when 'xunit.diagnosticMessages' is set in config (#28) • Report mismatched pre-release versions on failure (#23) • Fixed crash working with xUnit.net 1.1 diff --git a/resharper/nuget/xunitcontrib.nuspec b/resharper/nuget/xunitcontrib.nuspec index 1e1abf9..a5b520b 100644 --- a/resharper/nuget/xunitcontrib.nuspec +++ b/resharper/nuget/xunitcontrib.nuspec @@ -3,17 +3,18 @@ xunitcontrib xUnit.net Test Support - 2.1.6 + 2.1.7 Matt Ellis Matt Ellis A unit test provider for xUnit.net. Discovers and runs xUnit.net 1.x and 2.0 tests. Includes annotations to aid ReSharper inspections and Live Templates to speed up inserting test methods and asserts A unit test provider for xUnit.net - Support for xunit 2.0 + Don't crash if we get badly formatted exception data from xunit1 (#50) + +From previous builds: +• Support for xunit 2.0 • Rewritten the core runner to be more robust with multi-threading. Should fix issues with aborted or inconclusive tests (#44, #31) • Updated external annotations for xunit 2.0 (#30) • Read xunit 2.0 settings from config file (#40) - -From previous builds: • Report diagnostic messages when 'xunit.diagnosticMessages' is set in config (#28) • Report mismatched pre-release versions on failure (#23) • Fixed crash working with xUnit.net 1.1 From a28448d3b70fba73d26b6d2f813032b2814b8080 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Sun, 2 Aug 2015 23:42:50 +0100 Subject: [PATCH 11/24] Bumped version for 9.0 support --- resharper/nuget/xunitcontrib-rs9.nuspec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/resharper/nuget/xunitcontrib-rs9.nuspec b/resharper/nuget/xunitcontrib-rs9.nuspec index f34950d..fbe9e0b 100644 --- a/resharper/nuget/xunitcontrib-rs9.nuspec +++ b/resharper/nuget/xunitcontrib-rs9.nuspec @@ -3,12 +3,14 @@ CitizenMatt.Xunit xUnit.net Test Support for ReSharper 9 - 2.0.6 + 2.0.7 Matt Ellis Matt Ellis A unit test provider for xUnit.net. Discovers and runs xUnit.net 1.x and 2.0 tests. Includes annotations to aid ReSharper inspections and Live Templates to speed up inserting test methods and asserts. A unit test provider for xUnit.net - Support for xunit 2.0 + Don't crash if we get badly formatted exception data from xunit1 (#50) + +From previous builds: • Rewritten the core runner to be more robust with multi-threading. Should fix issues with aborted or inconclusive tests (#44, #31) • Updated external annotations for xunit 2.0 (#30) • Read xunit 2.0 settings from config file (#40) From 6f188e21afd46950b9b8dbf133cac209ad9da2c2 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Tue, 4 Aug 2015 23:21:53 +0100 Subject: [PATCH 12/24] Clean compile for 9.2 EAP 7 --- resharper/.nuget/packages.config | 2 + .../provider/CompatibilityExtensions.9.2.cs | 20 ++ .../src/provider/UnitTestElementFactory.cs | 15 +- resharper/src/provider/UnitTestElementId.cs | 2 +- .../UnitTestElementIdFactory-pre9.2.cs | 19 ++ .../UnitTestElementIdExtensions-pre9.2.cs | 12 + .../UnitTestElementIdExtensions.9.2.cs | 12 + .../UnitTestElements/XunitBaseElement.9.2.cs | 15 + .../UnitTestElements/XunitBaseElement.cs | 6 +- ...unitInheritedTestMethodContainerElement.cs | 6 +- .../UnitTestElements/XunitTestClassElement.cs | 10 +- .../XunitTestMethodElement.cs | 10 +- .../XunitTestTheoryElement.cs | 7 +- .../src/provider/XunitTestClassPresenter.cs | 8 + .../provider/XunitTestElementSerializer.cs | 7 +- .../src/provider/XunitTestElementsSource.cs | 10 + .../src/provider/XunitTestMetadataExplorer.cs | 6 + resharper/src/provider/ZoneMarker.cs | 2 +- .../provider/packages.provider-rs92.config | 46 +++ resharper/src/provider/provider-rs82.csproj | 2 + resharper/src/provider/provider-rs90.csproj | 3 + resharper/src/provider/provider-rs91.csproj | 2 + resharper/src/provider/provider-rs92.csproj | 288 ++++++++++++++++++ resharper/src/runner/Tasks/XunitTaskBase.cs | 1 - .../src/runner/packages.runner-rs92.config | 47 +++ resharper/src/runner/runner-rs92.csproj | 246 +++++++++++++++ .../Metadata/XunitMetadataTest.9.2.cs | 17 ++ .../AcceptanceTests/TestEnvironment.9.2.cs | 18 ++ ...UnitTestSessionManagerExtensions-pre9.2.cs | 25 ++ .../UnitTestTaskRunnerTestBase.9.2.cs | 67 ++++ .../UnitTestTaskRunnerTestBase.cs | 3 +- .../XunitMetdataTestBase.8.2.cs | 4 +- .../XunitMetdataTestBase.9.0.cs | 3 +- .../XunitMetdataTestBase.9.2.cs | 21 ++ .../XunitSourceTestBase.9.0.cs | 2 +- .../test/src/tests/packages.tests-rs92.config | 46 +++ resharper/test/src/tests/tests-rs82.csproj | 1 + resharper/test/src/tests/tests-rs90.csproj | 1 + resharper/test/src/tests/tests-rs91.csproj | 1 + resharper/test/src/tests/tests-rs92.csproj | 282 +++++++++++++++++ resharper/xunitcontrib-resharper.sln | 28 ++ 41 files changed, 1295 insertions(+), 28 deletions(-) create mode 100644 resharper/src/provider/CompatibilityExtensions.9.2.cs create mode 100644 resharper/src/provider/UnitTestElementIdFactory-pre9.2.cs create mode 100644 resharper/src/provider/UnitTestElements/UnitTestElementIdExtensions-pre9.2.cs create mode 100644 resharper/src/provider/UnitTestElements/UnitTestElementIdExtensions.9.2.cs create mode 100644 resharper/src/provider/UnitTestElements/XunitBaseElement.9.2.cs create mode 100644 resharper/src/provider/packages.provider-rs92.config create mode 100644 resharper/src/provider/provider-rs92.csproj create mode 100644 resharper/src/runner/packages.runner-rs92.config create mode 100644 resharper/src/runner/runner-rs92.csproj create mode 100644 resharper/test/src/tests/AcceptanceTests/Metadata/XunitMetadataTest.9.2.cs create mode 100644 resharper/test/src/tests/AcceptanceTests/TestEnvironment.9.2.cs create mode 100644 resharper/test/src/tests/AcceptanceTests/UnitTestSessionManagerExtensions-pre9.2.cs create mode 100644 resharper/test/src/tests/AcceptanceTests/UnitTestTaskRunnerTestBase.9.2.cs create mode 100644 resharper/test/src/tests/AcceptanceTests/XunitMetdataTestBase.9.2.cs create mode 100644 resharper/test/src/tests/packages.tests-rs92.config create mode 100644 resharper/test/src/tests/tests-rs92.csproj diff --git a/resharper/.nuget/packages.config b/resharper/.nuget/packages.config index b7beaae..48c159c 100644 --- a/resharper/.nuget/packages.config +++ b/resharper/.nuget/packages.config @@ -1,4 +1,6 @@  + + \ No newline at end of file diff --git a/resharper/src/provider/CompatibilityExtensions.9.2.cs b/resharper/src/provider/CompatibilityExtensions.9.2.cs new file mode 100644 index 0000000..ad86615 --- /dev/null +++ b/resharper/src/provider/CompatibilityExtensions.9.2.cs @@ -0,0 +1,20 @@ +using JetBrains.Metadata.Reader.API; +using JetBrains.ProjectModel; +using JetBrains.ReSharper.Feature.Services.CodeCompletion; +using JetBrains.ReSharper.Psi.Modules; + +namespace XunitContrib.Runner.ReSharper.UnitTestProvider +{ + public static class CompatibilityExtensions + { + public static IPsiModule GetPrimaryPsiModule(this IPsiModules psiModules, IModule module) + { + return psiModules.GetPrimaryPsiModule(module, TargetFrameworkId.Default); + } + + public static bool IsAutomaticCompletion(this CodeCompletionParameters parameters) + { + return parameters.IsAutomaticCompletion; + } + } +} \ No newline at end of file diff --git a/resharper/src/provider/UnitTestElementFactory.cs b/resharper/src/provider/UnitTestElementFactory.cs index bcee7f7..2bbc6b7 100644 --- a/resharper/src/provider/UnitTestElementFactory.cs +++ b/resharper/src/provider/UnitTestElementFactory.cs @@ -15,14 +15,17 @@ namespace XunitContrib.Runner.ReSharper.UnitTestProvider public class UnitTestElementFactory { private readonly XunitTestProvider provider; - private readonly UnitTestElementManager unitTestManager; + private readonly IUnitTestElementManager unitTestManager; + private readonly IUnitTestElementIdFactory unitTestElementIdFactory; private readonly DeclaredElementProvider declaredElementProvider; private readonly IUnitTestCategoryFactory categoryFactory; - public UnitTestElementFactory(XunitTestProvider provider, UnitTestElementManager unitTestManager, DeclaredElementProvider declaredElementProvider, IUnitTestCategoryFactory categoryFactory) + public UnitTestElementFactory(XunitTestProvider provider, IUnitTestElementManager unitTestManager, IUnitTestElementIdFactory unitTestElementIdFactory, + DeclaredElementProvider declaredElementProvider, IUnitTestCategoryFactory categoryFactory) { this.provider = provider; this.unitTestManager = unitTestManager; + this.unitTestElementIdFactory = unitTestElementIdFactory; this.declaredElementProvider = declaredElementProvider; this.categoryFactory = categoryFactory; } @@ -33,7 +36,7 @@ public XunitTestClassElement GetOrCreateTestClass(IProject project, IClrTypeName string assemblyLocation, OneToSetMap traits) { - var id = new UnitTestElementId(provider, new PersistentProjectId(project), typeName.FullName); + var id = unitTestElementIdFactory.Create(provider, new PersistentProjectId(project), typeName.FullName); return GetOrCreateTestClass(id, typeName, assemblyLocation, traits); } @@ -71,7 +74,7 @@ public XunitTestMethodElement GetOrCreateTestMethod(IProject project, XunitTestC OneToSetMap traits, bool isDynamic) { var methodId = GetTestMethodId(testClassElement, typeName, methodName); - var id = new UnitTestElementId(provider, new PersistentProjectId(project), methodId); + var id = unitTestElementIdFactory.Create(provider, new PersistentProjectId(project), methodId); return GetOrCreateTestMethod(id, testClassElement, typeName, methodName, skipReason, traits, isDynamic); } @@ -115,7 +118,7 @@ public XunitTestTheoryElement GetOrCreateTestTheory(IProject project, XunitTestM string name) { var theoryId = string.Format("{0}.{1}", methodElement.ShortId, GetTestTheoryShortName(name, methodElement)); - var id = new UnitTestElementId(provider, new PersistentProjectId(project), theoryId); + var id = unitTestElementIdFactory.Create(provider, new PersistentProjectId(project), theoryId); return GetOrCreateTestTheory(id, methodElement, name); } @@ -163,7 +166,7 @@ public XunitInheritedTestMethodContainerElement GetOrCreateInheritedTestMethodCo // This element never becomes a genuine test element, so dotCover will never see it, // but keep the id format the same var fullMethodName = typeName.FullName + "." + methodName; - var id = new UnitTestElementId(provider, new PersistentProjectId(project), fullMethodName); + var id = unitTestElementIdFactory.Create(provider, new PersistentProjectId(project), fullMethodName); var element = unitTestManager.GetElementById(id); if (element != null) return element as XunitInheritedTestMethodContainerElement; diff --git a/resharper/src/provider/UnitTestElementId.cs b/resharper/src/provider/UnitTestElementId.cs index 1f85ec6..a7b9817 100644 --- a/resharper/src/provider/UnitTestElementId.cs +++ b/resharper/src/provider/UnitTestElementId.cs @@ -107,7 +107,7 @@ public IEnumerable Create(IEnumerable categorie public static class UnitTestElementManagerExtensions { - public static IUnitTestElement GetElementById(this UnitTestElementManager manager, UnitTestElementId id) + public static IUnitTestElement GetElementById(this IUnitTestElementManager manager, UnitTestElementId id) { return manager.GetElementById(id.GetProject(), id.ToString()); } diff --git a/resharper/src/provider/UnitTestElementIdFactory-pre9.2.cs b/resharper/src/provider/UnitTestElementIdFactory-pre9.2.cs new file mode 100644 index 0000000..e4f8018 --- /dev/null +++ b/resharper/src/provider/UnitTestElementIdFactory-pre9.2.cs @@ -0,0 +1,19 @@ +using JetBrains.ProjectModel; +using JetBrains.ReSharper.UnitTestFramework; + +namespace XunitContrib.Runner.ReSharper.UnitTestProvider +{ + public interface IUnitTestElementIdFactory + { + UnitTestElementId Create(IUnitTestProvider provider, PersistentProjectId persistentProjectId, string id); + } + + [SolutionComponent] + public class UnitTestElementIdFactory : IUnitTestElementIdFactory + { + public UnitTestElementId Create(IUnitTestProvider provider, PersistentProjectId persistentProjectId, string id) + { + return new UnitTestElementId(provider, persistentProjectId, id); + } + } +} \ No newline at end of file diff --git a/resharper/src/provider/UnitTestElements/UnitTestElementIdExtensions-pre9.2.cs b/resharper/src/provider/UnitTestElements/UnitTestElementIdExtensions-pre9.2.cs new file mode 100644 index 0000000..309dbd7 --- /dev/null +++ b/resharper/src/provider/UnitTestElements/UnitTestElementIdExtensions-pre9.2.cs @@ -0,0 +1,12 @@ +using JetBrains.ReSharper.UnitTestFramework; + +namespace XunitContrib.Runner.ReSharper.UnitTestProvider +{ + public static class UnitTestElementIdExtensions + { + public static string GetPersistentProjectId(this UnitTestElementId id) + { + return id.PersistentProjectId.Id; + } + } +} \ No newline at end of file diff --git a/resharper/src/provider/UnitTestElements/UnitTestElementIdExtensions.9.2.cs b/resharper/src/provider/UnitTestElements/UnitTestElementIdExtensions.9.2.cs new file mode 100644 index 0000000..2baa31d --- /dev/null +++ b/resharper/src/provider/UnitTestElements/UnitTestElementIdExtensions.9.2.cs @@ -0,0 +1,12 @@ +using JetBrains.ReSharper.UnitTestFramework; + +namespace XunitContrib.Runner.ReSharper.UnitTestProvider +{ + public static class UnitTestElementIdExtensions + { + public static string GetPersistentProjectId(this UnitTestElementId id) + { + return id.Project.Id; + } + } +} \ No newline at end of file diff --git a/resharper/src/provider/UnitTestElements/XunitBaseElement.9.2.cs b/resharper/src/provider/UnitTestElements/XunitBaseElement.9.2.cs new file mode 100644 index 0000000..2ebf7af --- /dev/null +++ b/resharper/src/provider/UnitTestElements/XunitBaseElement.9.2.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; +using JetBrains.ReSharper.UnitTestFramework; + +namespace XunitContrib.Runner.ReSharper.UnitTestProvider +{ + public partial class XunitBaseElement + { + public UnitTestElementId Id { get { return UnitTestElementId; } } + + protected static UnitTestElementNamespace GetNamespace(IEnumerable namespaces) + { + return UnitTestElementNamespaceFactory.Create(namespaces); + } + } +} \ No newline at end of file diff --git a/resharper/src/provider/UnitTestElements/XunitBaseElement.cs b/resharper/src/provider/UnitTestElements/XunitBaseElement.cs index d371bd7..9a05dd5 100644 --- a/resharper/src/provider/UnitTestElements/XunitBaseElement.cs +++ b/resharper/src/provider/UnitTestElements/XunitBaseElement.cs @@ -6,6 +6,10 @@ using JetBrains.ReSharper.UnitTestFramework.Strategy; using XunitContrib.Runner.ReSharper.RemoteRunner; +#if !RESHARPER92 +using UnitTestElementNamespace = JetBrains.ReSharper.UnitTestFramework.UnitTestNamespace; +#endif + namespace XunitContrib.Runner.ReSharper.UnitTestProvider { public abstract partial class XunitBaseElement : IUnitTestElement @@ -63,7 +67,7 @@ public IUnitTestElement Parent public bool Explicit { get { return !string.IsNullOrEmpty(ExplicitReason); } } public virtual UnitTestElementState State { get; set; } public abstract string GetPresentation(IUnitTestElement parentElement, bool full); - public abstract UnitTestNamespace GetNamespace(); + public abstract UnitTestElementNamespace GetNamespace(); public abstract UnitTestElementDisposition GetDisposition(); public abstract IDeclaredElement GetDeclaredElement(); public abstract IEnumerable GetProjectFiles(); diff --git a/resharper/src/provider/UnitTestElements/XunitInheritedTestMethodContainerElement.cs b/resharper/src/provider/UnitTestElements/XunitInheritedTestMethodContainerElement.cs index d2071c4..5f59104 100644 --- a/resharper/src/provider/UnitTestElements/XunitInheritedTestMethodContainerElement.cs +++ b/resharper/src/provider/UnitTestElements/XunitInheritedTestMethodContainerElement.cs @@ -6,6 +6,10 @@ using JetBrains.ReSharper.UnitTestFramework; using JetBrains.Util; +#if !RESHARPER92 +using UnitTestElementNamespace = JetBrains.ReSharper.UnitTestFramework.UnitTestNamespace; +#endif + namespace XunitContrib.Runner.ReSharper.UnitTestProvider { public class XunitInheritedTestMethodContainerElement : XunitBaseElement, IEquatable @@ -31,7 +35,7 @@ public override string GetPresentation(IUnitTestElement parent, bool full) return methodName; } - public override UnitTestNamespace GetNamespace() + public override UnitTestElementNamespace GetNamespace() { return GetNamespace(TypeName.NamespaceNames); } diff --git a/resharper/src/provider/UnitTestElements/XunitTestClassElement.cs b/resharper/src/provider/UnitTestElements/XunitTestClassElement.cs index d4a7c67..9b826a5 100644 --- a/resharper/src/provider/UnitTestElements/XunitTestClassElement.cs +++ b/resharper/src/provider/UnitTestElements/XunitTestClassElement.cs @@ -7,12 +7,14 @@ using JetBrains.ProjectModel; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.Tree; -using JetBrains.ReSharper.Resources.Shell; using JetBrains.ReSharper.UnitTestFramework; using JetBrains.Util; -using XunitContrib.Runner.ReSharper.RemoteRunner; using XunitContrib.Runner.ReSharper.RemoteRunner.Tasks; +#if !RESHARPER92 +using UnitTestElementNamespace = JetBrains.ReSharper.UnitTestFramework.UnitTestNamespace; +#endif + namespace XunitContrib.Runner.ReSharper.UnitTestProvider { public class XunitTestClassElement : XunitBaseElement, ISerializableUnitTestElement, IEquatable @@ -42,7 +44,7 @@ public override string GetPresentation(IUnitTestElement parent, bool full) return ShortName; } - public override UnitTestNamespace GetNamespace() + public override UnitTestElementNamespace GetNamespace() { return GetNamespace(TypeName.NamespaceNames); } @@ -100,7 +102,7 @@ public override string Kind get { return "xUnit.net Test Class"; } } - public string ProjectId { get { return UnitTestElementId.PersistentProjectId.Id; } } + public string ProjectId { get { return UnitTestElementId.GetPersistentProjectId(); } } public string AssemblyLocation { get; set; } public IClrTypeName TypeName { get; private set; } diff --git a/resharper/src/provider/UnitTestElements/XunitTestMethodElement.cs b/resharper/src/provider/UnitTestElements/XunitTestMethodElement.cs index 998edb6..00555ab 100644 --- a/resharper/src/provider/UnitTestElements/XunitTestMethodElement.cs +++ b/resharper/src/provider/UnitTestElements/XunitTestMethodElement.cs @@ -6,14 +6,16 @@ using JetBrains.Metadata.Reader.Impl; using JetBrains.ProjectModel; using JetBrains.ReSharper.Psi; -using JetBrains.ReSharper.UnitTestFramework; using JetBrains.ReSharper.Psi.Tree; using JetBrains.ReSharper.Psi.Util; +using JetBrains.ReSharper.UnitTestFramework; using JetBrains.Util; -using Xunit.Sdk; -using XunitContrib.Runner.ReSharper.RemoteRunner; using XunitContrib.Runner.ReSharper.RemoteRunner.Tasks; +#if !RESHARPER92 +using UnitTestElementNamespace = JetBrains.ReSharper.UnitTestFramework.UnitTestNamespace; +#endif + namespace XunitContrib.Runner.ReSharper.UnitTestProvider { public partial class XunitTestMethodElement : XunitBaseElement, ISerializableUnitTestElement, IEquatable @@ -63,7 +65,7 @@ public override string GetPresentation(IUnitTestElement parentElement, bool full return string.Format("{0}.{1}", Parent.GetPresentation(), MethodName); } - public override UnitTestNamespace GetNamespace() + public override UnitTestElementNamespace GetNamespace() { // Parent can be null for invalid elements return Parent != null ? Parent.GetNamespace() : GetNamespace(TypeName.NamespaceNames); diff --git a/resharper/src/provider/UnitTestElements/XunitTestTheoryElement.cs b/resharper/src/provider/UnitTestElements/XunitTestTheoryElement.cs index 6e05c80..17716ea 100644 --- a/resharper/src/provider/UnitTestElements/XunitTestTheoryElement.cs +++ b/resharper/src/provider/UnitTestElements/XunitTestTheoryElement.cs @@ -4,9 +4,12 @@ using JetBrains.ProjectModel; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.UnitTestFramework; -using XunitContrib.Runner.ReSharper.RemoteRunner; using XunitContrib.Runner.ReSharper.RemoteRunner.Tasks; +#if !RESHARPER92 +using UnitTestElementNamespace = JetBrains.ReSharper.UnitTestFramework.UnitTestNamespace; +#endif + namespace XunitContrib.Runner.ReSharper.UnitTestProvider { public class XunitTestTheoryElement : XunitBaseElement, ISerializableUnitTestElement, IEquatable @@ -31,7 +34,7 @@ public override string GetPresentation(IUnitTestElement parentElement, bool full return ShortName; } - public override UnitTestNamespace GetNamespace() + public override UnitTestElementNamespace GetNamespace() { return Parent == null ? null : Parent.GetNamespace(); } diff --git a/resharper/src/provider/XunitTestClassPresenter.cs b/resharper/src/provider/XunitTestClassPresenter.cs index 4f603d2..6272852 100644 --- a/resharper/src/provider/XunitTestClassPresenter.cs +++ b/resharper/src/provider/XunitTestClassPresenter.cs @@ -37,11 +37,19 @@ public TreePresenter() protected override bool IsNaturalParent(object parentValue, object childValue) { +#if !RESHARPER92 var unitTestNamespace = parentValue as IUnitTestNamespace; var classElement = childValue as XunitTestClassElement; if (classElement != null && unitTestNamespace != null) return unitTestNamespace.NamespaceName.Equals(classElement.GetNamespace().NamespaceName); return base.IsNaturalParent(parentValue, childValue); +#else + var unitTestNamespace = parentValue as IUnitTestElementNamespace; + var classElement = childValue as XunitTestClassElement; + if (classElement != null && unitTestNamespace != null) + return unitTestNamespace.QualifiedName.Equals(classElement.GetNamespace().QualifiedName); + return base.IsNaturalParent(parentValue, childValue); +#endif } protected override object Unwrap(object value) diff --git a/resharper/src/provider/XunitTestElementSerializer.cs b/resharper/src/provider/XunitTestElementSerializer.cs index 12b0f09..2db3371 100644 --- a/resharper/src/provider/XunitTestElementSerializer.cs +++ b/resharper/src/provider/XunitTestElementSerializer.cs @@ -20,13 +20,16 @@ public class XunitTestElementSerializer : IUnitTestElementSerializer }; private readonly XunitTestProvider provider; + private readonly IUnitTestElementIdFactory unitTestElementIdFactory; private readonly UnitTestElementFactory unitTestElementFactory; private readonly ISolution solution; private readonly IShellLocks locks; - public XunitTestElementSerializer(XunitTestProvider provider, UnitTestElementFactory unitTestElementFactory, ISolution solution, IShellLocks locks) + public XunitTestElementSerializer(XunitTestProvider provider, IUnitTestElementIdFactory unitTestElementIdFactory, + UnitTestElementFactory unitTestElementFactory, ISolution solution, IShellLocks locks) { this.provider = provider; + this.unitTestElementIdFactory = unitTestElementIdFactory; this.unitTestElementFactory = unitTestElementFactory; this.solution = solution; this.locks = locks; @@ -62,7 +65,7 @@ public IUnitTestElement DeserializeElement(XmlElement parent, string id, IUnitTe if (!parent.HasAttribute("type")) throw new ArgumentException("Element is not xunit"); - var unitTestElementId = new UnitTestElementId(provider, projectId, id); + var unitTestElementId = unitTestElementIdFactory.Create(provider, projectId, id); ReadFromXmlFunc func; if (DeserialiseMap.TryGetValue(parent.GetAttribute("type"), out func)) diff --git a/resharper/src/provider/XunitTestElementsSource.cs b/resharper/src/provider/XunitTestElementsSource.cs index 9a080bc..33811f9 100644 --- a/resharper/src/provider/XunitTestElementsSource.cs +++ b/resharper/src/provider/XunitTestElementsSource.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Threading; using JetBrains.Application; using JetBrains.Metadata.Reader.API; using JetBrains.ProjectModel; @@ -10,6 +11,7 @@ using JetBrains.Util; using JetBrains.Util.Logging; + namespace XunitContrib.Runner.ReSharper.UnitTestProvider { [SolutionComponent] @@ -36,10 +38,18 @@ public void ExploreSolution(IUnitTestElementsObserver observer) // Do nothing. We find all tests via source, or via assembly metadata } +#if !RESHARPER92 public void ExploreProjects(IDictionary projects, MetadataLoader loader, IUnitTestElementsObserver observer) +#else + public void ExploreProjects(IDictionary projects, MetadataLoader loader, IUnitTestElementsObserver observer, CancellationToken cancellationToken) +#endif { var explorer = new XunitTestMetadataExplorer(provider, unitTestElementFactory); +#if !RESHARPER92 metadataElementsSource.ExploreProjects(projects, loader, observer, explorer.ExploreAssembly); +#else + metadataElementsSource.ExploreProjects(projects, loader, observer, explorer.ExploreAssembly, cancellationToken); +#endif observer.OnCompleted(); } diff --git a/resharper/src/provider/XunitTestMetadataExplorer.cs b/resharper/src/provider/XunitTestMetadataExplorer.cs index 958af7d..c1442cc 100644 --- a/resharper/src/provider/XunitTestMetadataExplorer.cs +++ b/resharper/src/provider/XunitTestMetadataExplorer.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Threading; using JetBrains.Application; using JetBrains.Metadata.Reader.API; using JetBrains.Metadata.Reader.Impl; @@ -22,8 +23,13 @@ public XunitTestMetadataExplorer(XunitTestProvider provider, UnitTestElementFact this.unitTestElementFactory = unitTestElementFactory; } +#if !RESHARPER92 public void ExploreAssembly(IProject project, IMetadataAssembly assembly, IUnitTestElementsObserver observer) +#else + public void ExploreAssembly(IProject project, IMetadataAssembly assembly, IUnitTestElementsObserver observer, CancellationToken cancellationToken) +#endif { + // TODO: Check cancellation token and exit early using (ReadLockCookie.Create()) { foreach (var metadataTypeInfo in GetExportedTypes(assembly.GetTypes())) diff --git a/resharper/src/provider/ZoneMarker.cs b/resharper/src/provider/ZoneMarker.cs index 1effa0c..7d3818d 100644 --- a/resharper/src/provider/ZoneMarker.cs +++ b/resharper/src/provider/ZoneMarker.cs @@ -4,7 +4,7 @@ namespace XunitContrib.Runner.ReSharper.UnitTestProvider { [ZoneMarker] - public class ZoneMarker : IRequire + public class ZoneMarker { } } \ No newline at end of file diff --git a/resharper/src/provider/packages.provider-rs92.config b/resharper/src/provider/packages.provider-rs92.config new file mode 100644 index 0000000..6eadaec --- /dev/null +++ b/resharper/src/provider/packages.provider-rs92.config @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resharper/src/provider/provider-rs82.csproj b/resharper/src/provider/provider-rs82.csproj index 4027704..3ed35e7 100644 --- a/resharper/src/provider/provider-rs82.csproj +++ b/resharper/src/provider/provider-rs82.csproj @@ -61,6 +61,8 @@ + + diff --git a/resharper/src/provider/provider-rs90.csproj b/resharper/src/provider/provider-rs90.csproj index d89e038..0c98690 100644 --- a/resharper/src/provider/provider-rs90.csproj +++ b/resharper/src/provider/provider-rs90.csproj @@ -131,6 +131,7 @@ ..\..\packages\TaskParallelLibrary.1.0.2856.0\lib\Net35\System.Threading.dll + global @@ -176,7 +177,9 @@ + + diff --git a/resharper/src/provider/provider-rs91.csproj b/resharper/src/provider/provider-rs91.csproj index f2616bd..93896da 100644 --- a/resharper/src/provider/provider-rs91.csproj +++ b/resharper/src/provider/provider-rs91.csproj @@ -180,7 +180,9 @@ + + diff --git a/resharper/src/provider/provider-rs92.csproj b/resharper/src/provider/provider-rs92.csproj new file mode 100644 index 0000000..59bb55e --- /dev/null +++ b/resharper/src/provider/provider-rs92.csproj @@ -0,0 +1,288 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {71819B7E-E124-44CE-9B92-60345A4A2856} + Library + Properties + XunitContrib.Runner.ReSharper.UnitTestProvider + xunitcontrib.runner.resharper.provider.9.2 + v4.0 + 512 + + 0ed3b45b + + + true + full + false + bin\rs92\Debug\ + TRACE;DEBUG;RESHARPER92 + prompt + 4 + false + + + pdbonly + true + bin\rs92\Release\ + TRACE;RESHARPER92 + prompt + 4 + false + + + + False + ..\..\packages\Antlr2.Runtime.2.7.7.02\lib\antlr.runtime.dll + + + False + ..\..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll + + + ..\..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.Data.v7.1.dll + True + + + ..\..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.Utils.v7.1.dll + True + + + ..\..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.XtraEditors.v7.1.dll + True + + + ..\..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.XtraTreeList.v7.1.dll + True + + + ..\..\packages\SharpZipLib.JetBrains.Stripped.0.86.20150204.1\lib\20\ICSharpCode.SharpZipLib.dll + True + + + False + ..\..\packages\DotNetZip.Reduced.1.9.1.8\lib\net20\Ionic.Zip.Reduced.dll + + + ..\..\packages\JetBrains.Unix.Utils.20150702.4\lib\net40\JbUnixUtils.dll + True + + + ..\..\packages\JetBrains.Annotations.9.1.1\lib\net20\JetBrains.Annotations.dll + True + + + False + ..\..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.Compression.Cab.2.0.20140304.0\lib\Microsoft.Deployment.Compression.dll + + + False + ..\..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.Compression.Cab.2.0.20140304.0\lib\Microsoft.Deployment.Compression.Cab.dll + + + ..\..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.WindowsInstaller.2.0.20140821.0\lib\Microsoft.Deployment.WindowsInstaller.dll + True + + + True + ..\..\packages\JetBrains.Platform.Lib.VisualStudio.AnyVs.ShellInterop.PrivateBuild.2.0.20140304.0\lib\Microsoft.VisualStudio.Shell.Interop.dll + + + False + ..\..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll + + + ..\..\packages\Windows7APICodePack.JetBrains.Stripped.1.1.20150225.0\lib\Net\Microsoft.WindowsAPICodePack.dll + True + + + ..\..\packages\Windows7APICodePack.JetBrains.Stripped.1.1.20150225.0\lib\Net\Microsoft.WindowsAPICodePack.Shell.dll + True + + + False + ..\..\packages\Newtonsoft35.Json.7.0.1\lib\net35\Newtonsoft.Json.dll + + + ..\..\packages\NuGet.Core.2.8.6\lib\net40-Client\NuGet.Core.dll + True + + + ..\..\packages\NUnit.Core.2.6.4\lib\nunit.core.dll + True + + + ..\..\packages\NUnit.Core.2.6.4\lib\nunit.core.interfaces.dll + True + + + ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + True + + + ..\..\packages\NUnit.Core.2.6.4\lib\nunit.util.dll + True + + + False + ..\..\packages\NVelocity.1.0.3\lib\NVelocity.dll + + + + ..\..\packages\Sprache.JetBrains.2.0.0.44\lib\portable-net4+netcore45+win8+wp8+sl5+MonoAndroid1+MonoTouch1\Sprache.dll + True + + + + + + + False + ..\..\packages\JetBrains.Platform.Lib.System.Windows.Interactivity.2.0.20140318.0\lib\System.Windows.Interactivity.dll + + + + ..\..\packages\Vestris.ResourceLib.JetBrains.1.4.20150303.0\lib\Net\Vestris.ResourceLib.dll + True + + + + ..\..\packages\JetBrains.Platform.Lib.WpfContrib.2.0.20150225.0\lib\Net\WpfContrib.dll + True + + + False + ..\..\..\3rdParty\xUnit.net-1.9.1\xunit.dll + + + False + ..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll + + + + + Properties\CommonAssemblyInfo.cs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + Designer + + + + + + {a29f00fb-cec9-4fdc-8a0c-ce8d580b0fde} + runner-rs92 + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resharper/src/runner/Tasks/XunitTaskBase.cs b/resharper/src/runner/Tasks/XunitTaskBase.cs index 27c8f3c..c8388b6 100644 --- a/resharper/src/runner/Tasks/XunitTaskBase.cs +++ b/resharper/src/runner/Tasks/XunitTaskBase.cs @@ -1,6 +1,5 @@ using System.Xml; using JetBrains.ReSharper.TaskRunnerFramework; -using JetBrains.ReSharper.UnitTestFramework; namespace XunitContrib.Runner.ReSharper.RemoteRunner.Tasks { diff --git a/resharper/src/runner/packages.runner-rs92.config b/resharper/src/runner/packages.runner-rs92.config new file mode 100644 index 0000000..af47770 --- /dev/null +++ b/resharper/src/runner/packages.runner-rs92.config @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resharper/src/runner/runner-rs92.csproj b/resharper/src/runner/runner-rs92.csproj new file mode 100644 index 0000000..34b3920 --- /dev/null +++ b/resharper/src/runner/runner-rs92.csproj @@ -0,0 +1,246 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {A29F00FB-CEC9-4FDC-8A0C-CE8D580B0FDE} + Library + Properties + XunitContrib.Runner.ReSharper.RemoteRunner + xunitcontrib.runner.resharper.runner.9.2 + v4.0 + 512 + + 7690569e + + + true + full + false + bin\rs92\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\rs92\Release\ + TRACE + prompt + 4 + false + + + + ..\..\packages\Antlr2.Runtime.2.7.7.02\lib\antlr.runtime.dll + True + + + ..\..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll + True + + + ..\..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.Data.v7.1.dll + True + + + ..\..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.Utils.v7.1.dll + True + + + ..\..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.XtraEditors.v7.1.dll + True + + + ..\..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.XtraTreeList.v7.1.dll + True + + + ..\..\packages\SharpZipLib.JetBrains.Stripped.0.86.20150204.1\lib\20\ICSharpCode.SharpZipLib.dll + True + + + ..\..\packages\DotNetZip.Reduced.1.9.1.8\lib\net20\Ionic.Zip.Reduced.dll + True + + + ..\..\packages\JetBrains.Unix.Utils.20150702.4\lib\net40\JbUnixUtils.dll + True + + + ..\..\packages\JetBrains.Annotations.9.1.1\lib\net20\JetBrains.Annotations.dll + True + + + ..\..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.Compression.Cab.2.0.20140304.0\lib\Microsoft.Deployment.Compression.dll + True + + + ..\..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.Compression.Cab.2.0.20140304.0\lib\Microsoft.Deployment.Compression.Cab.dll + True + + + ..\..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.WindowsInstaller.2.0.20140821.0\lib\Microsoft.Deployment.WindowsInstaller.dll + True + + + ..\..\packages\JetBrains.Platform.Lib.VisualStudio.AnyVs.ShellInterop.PrivateBuild.2.0.20140304.0\lib\Microsoft.VisualStudio.Shell.Interop.dll + True + + + ..\..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll + True + + + ..\..\packages\Windows7APICodePack.JetBrains.Stripped.1.1.20150225.0\lib\Net\Microsoft.WindowsAPICodePack.dll + True + + + ..\..\packages\Windows7APICodePack.JetBrains.Stripped.1.1.20150225.0\lib\Net\Microsoft.WindowsAPICodePack.Shell.dll + True + + + ..\..\packages\Newtonsoft35.Json.7.0.1\lib\net35\Newtonsoft.Json.dll + True + + + ..\..\packages\NuGet.Core.2.8.6\lib\net40-Client\NuGet.Core.dll + True + + + ..\..\packages\NUnit.Core.2.6.4\lib\nunit.core.dll + True + + + ..\..\packages\NUnit.Core.2.6.4\lib\nunit.core.interfaces.dll + True + + + ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + True + + + ..\..\packages\NUnit.Core.2.6.4\lib\nunit.util.dll + True + + + ..\..\packages\NVelocity.1.0.3\lib\NVelocity.dll + True + + + ..\..\packages\Sprache.JetBrains.2.0.0.44\lib\portable-net4+netcore45+win8+wp8+sl5+MonoAndroid1+MonoTouch1\Sprache.dll + True + + + + + ..\..\packages\JetBrains.Platform.Lib.System.Windows.Interactivity.2.0.20140318.0\lib\System.Windows.Interactivity.dll + True + + + + ..\..\packages\Vestris.ResourceLib.JetBrains.1.4.20150303.0\lib\Net\Vestris.ResourceLib.dll + True + + + ..\..\packages\JetBrains.Platform.Lib.WpfContrib.2.0.20150225.0\lib\Net\WpfContrib.dll + True + + + False + ..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll + + + False + ..\..\packages\xunit.runner.utility.2.0.0\lib\net35\xunit.runner.utility.desktop.dll + + + + + Properties\CommonAssemblyInfo.cs + + + Properties\ProductInfo.ReSharper.9.0.cs + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resharper/test/src/tests/AcceptanceTests/Metadata/XunitMetadataTest.9.2.cs b/resharper/test/src/tests/AcceptanceTests/Metadata/XunitMetadataTest.9.2.cs new file mode 100644 index 0000000..9138015 --- /dev/null +++ b/resharper/test/src/tests/AcceptanceTests/Metadata/XunitMetadataTest.9.2.cs @@ -0,0 +1,17 @@ +using JetBrains.TestFramework.Utils; + +namespace XunitContrib.Runner.ReSharper.Tests.AcceptanceTests.Metadata +{ + public partial class XunitMetadataTest + { + partial void InferProductHomeDir() + { + // TestCases is called before the environment fixture is run, which would either + // ensure Product.Root exists, or infer %JetProductHomeDir%. By using SoutionItemsBasePath + // in TestCases, we fallback to the non-extension friendly implementation that expects + // the source to be laid out as if we're building the product, not an extension, and it + // requires Product.Root. We'll infer it instead. + TestUtil.SetHomeDir(GetType().Assembly); + } + } +} \ No newline at end of file diff --git a/resharper/test/src/tests/AcceptanceTests/TestEnvironment.9.2.cs b/resharper/test/src/tests/AcceptanceTests/TestEnvironment.9.2.cs new file mode 100644 index 0000000..2d0075f --- /dev/null +++ b/resharper/test/src/tests/AcceptanceTests/TestEnvironment.9.2.cs @@ -0,0 +1,18 @@ +using JetBrains.Application.BuildScript.Application.Zones; +using JetBrains.ReSharper.TestFramework; +using JetBrains.TestFramework; +using JetBrains.TestFramework.Application.Zones; +using NUnit.Framework; + +namespace XunitContrib.Runner.ReSharper.Tests.AcceptanceTests +{ + [ZoneDefinition] + public interface IXunitTestZone : ITestsZone, IRequire + { + } + + [SetUpFixture] + public class TestEnvironmentAssembly : ExtensionTestEnvironmentAssembly + { + } +} diff --git a/resharper/test/src/tests/AcceptanceTests/UnitTestSessionManagerExtensions-pre9.2.cs b/resharper/test/src/tests/AcceptanceTests/UnitTestSessionManagerExtensions-pre9.2.cs new file mode 100644 index 0000000..ba12b93 --- /dev/null +++ b/resharper/test/src/tests/AcceptanceTests/UnitTestSessionManagerExtensions-pre9.2.cs @@ -0,0 +1,25 @@ +using JetBrains.ReSharper.UnitTestFramework; +using JetBrains.ReSharper.UnitTestFramework.Criteria; + +namespace JetBrains.ReSharper.UnitTestFramework.Criteria +{ + public interface IUnitTestElementCriterion + { + } + + public class NothingCriterion : IUnitTestElementCriterion + { + public static readonly NothingCriterion Instance = new NothingCriterion(); + } +} + +namespace XunitContrib.Runner.ReSharper.Tests.AcceptanceTests +{ + public static class UnitTestSessionManagerExtensions + { + public static IUnitTestSessionView CreateSession(this IUnitTestSessionManager sessionManager, IUnitTestElementCriterion criterion) + { + return sessionManager.CreateSession(); + } + } +} \ No newline at end of file diff --git a/resharper/test/src/tests/AcceptanceTests/UnitTestTaskRunnerTestBase.9.2.cs b/resharper/test/src/tests/AcceptanceTests/UnitTestTaskRunnerTestBase.9.2.cs new file mode 100644 index 0000000..925558e --- /dev/null +++ b/resharper/test/src/tests/AcceptanceTests/UnitTestTaskRunnerTestBase.9.2.cs @@ -0,0 +1,67 @@ +using System.Collections.Generic; +using System.IO; +using System.Threading; +using JetBrains.Metadata.Reader.API; +using JetBrains.ProjectModel; +using JetBrains.ReSharper.TaskRunnerFramework; +using JetBrains.ReSharper.TestFramework.Components.UnitTestSupport; +using JetBrains.ReSharper.UnitTestFramework; +using JetBrains.Util; +using JetBrains.Util.Logging; + +namespace XunitContrib.Runner.ReSharper.Tests.AcceptanceTests +{ + public abstract partial class UnitTestTaskRunnerTestBase + { + private int GetServerPortNumber() + { + var unitTestServer = Solution.GetComponent(); + return unitTestServer.PortNumber; + } + + private IRemoteChannel GetRemoteChannel() + { + var unitTestServer = Solution.GetComponent(); + return unitTestServer.RemoteChannel; + } + + public abstract IUnitTestElementsSource MetadataExplorer { get; } + + protected virtual ICollection GetUnitTestElements(IProject testProject, string assemblyLocation) + { + var observer = new TestUnitTestElementObserver(); + + var resolver = new DefaultAssemblyResolver(); + resolver.AddPath(FileSystemPath.Parse(assemblyLocation).Directory); + + using (var loader = new MetadataLoader(resolver)) + { + MetadataExplorer.ExploreProjects( + new Dictionary + { + {testProject, FileSystemPath.Parse(assemblyLocation)} + }, + loader, observer, CancellationToken.None); + } + return observer.Elements; + } + + protected virtual ITaskRunnerHostController CreateTaskRunnerHostController(IUnitTestLaunchManager launchManager, IUnitTestResultManager resultManager, IUnitTestAgentManager agentManager, TextWriter output, IUnitTestLaunch launch, int port, TestRemoteChannelMessageListener msgListener) + { + return new ProcessTaskRunnerHostController(Logger.GetLogger(typeof(UnitTestTaskRunnerTestBase)), launchManager, resultManager, agentManager, launch, port, null); + } + + // 9.1 RTM SDK has a nasty little bug where each test takes 30 seconds to run + // The issue is that TaskRunnerHostControllerBase.FinishRun calls IUnitTestLaunch.FinishRun, + // but the implementation, in UnitTestSessionTestImpl, does nothing. Instead, it's expecting + // a call to UnitTestSessionTestImpl.Finish, which will run the action we pass to OnFinish + // and signal the event. Because the event doesn't get signalled, we have to wait 30 seconds + // for the timeout. This wrapper class implements IUnitTestLaunch by deferring to + // UnitTestSessionTestImpl, and implementing FinishRun by calling UnitTestSessionTestImpl.Finish + // https://youtrack.jetbrains.com/issue/RSRP-437172 + private static IUnitTestLaunch GetUnitTestLaunch(UnitTestSessionTestImpl session) + { + return session; + } + } +} \ No newline at end of file diff --git a/resharper/test/src/tests/AcceptanceTests/UnitTestTaskRunnerTestBase.cs b/resharper/test/src/tests/AcceptanceTests/UnitTestTaskRunnerTestBase.cs index 6d9109b..2334f3d 100644 --- a/resharper/test/src/tests/AcceptanceTests/UnitTestTaskRunnerTestBase.cs +++ b/resharper/test/src/tests/AcceptanceTests/UnitTestTaskRunnerTestBase.cs @@ -12,6 +12,7 @@ using JetBrains.ReSharper.TestFramework; using JetBrains.ReSharper.TestFramework.Components.UnitTestSupport; using JetBrains.ReSharper.UnitTestFramework; +using JetBrains.ReSharper.UnitTestFramework.Criteria; using JetBrains.ReSharper.UnitTestFramework.Strategy; using JetBrains.ReSharper.UnitTestSupportTests; using JetBrains.Util; @@ -46,7 +47,7 @@ protected override void DoTest(IProject testProject) Assert.IsNotEmpty(tests, "No tests to run"); var unitTestLaunchManagerTestImpl = Solution.GetComponent(); - var session = (UnitTestSessionTestImpl)sessionManager.CreateSession(); + var session = (UnitTestSessionTestImpl)sessionManager.CreateSession(NothingCriterion.Instance); unitTestLaunchManagerTestImpl.AddLaunch(lt, session); var sequences = tests.Select(unitTestElement => unitTestElement.GetTaskSequence(EmptyList.InstanceList, session)).Where(sequence => sequence.Count > 0).ToList(); diff --git a/resharper/test/src/tests/AcceptanceTests/XunitMetdataTestBase.8.2.cs b/resharper/test/src/tests/AcceptanceTests/XunitMetdataTestBase.8.2.cs index a7eb610..81c61a7 100644 --- a/resharper/test/src/tests/AcceptanceTests/XunitMetdataTestBase.8.2.cs +++ b/resharper/test/src/tests/AcceptanceTests/XunitMetdataTestBase.8.2.cs @@ -1,7 +1,7 @@ +using System.Threading; using JetBrains.Metadata.Reader.API; using JetBrains.ProjectModel; using JetBrains.ReSharper.UnitTestFramework; -using XunitContrib.Runner.ReSharper.UnitTestProvider; namespace XunitContrib.Runner.ReSharper.Tests.AcceptanceTests { @@ -9,7 +9,7 @@ public abstract partial class XunitMetdataTestBase { protected override void ExploreAssembly(IProject testProject, IMetadataAssembly metadataAssembly, UnitTestElementConsumer add) { - GetMetdataExplorer().ExploreAssembly(testProject, metadataAssembly, new UnitTestElementsObserver(add)); + GetMetdataExplorer().ExploreAssembly(testProject, metadataAssembly, add, new ManualResetEvent(false)); } } } \ No newline at end of file diff --git a/resharper/test/src/tests/AcceptanceTests/XunitMetdataTestBase.9.0.cs b/resharper/test/src/tests/AcceptanceTests/XunitMetdataTestBase.9.0.cs index 14ee9e1..1878bdb 100644 --- a/resharper/test/src/tests/AcceptanceTests/XunitMetdataTestBase.9.0.cs +++ b/resharper/test/src/tests/AcceptanceTests/XunitMetdataTestBase.9.0.cs @@ -1,6 +1,7 @@ using JetBrains.Metadata.Reader.API; using JetBrains.ProjectModel; using JetBrains.ReSharper.UnitTestFramework; +using XunitContrib.Runner.ReSharper.UnitTestProvider; namespace XunitContrib.Runner.ReSharper.Tests.AcceptanceTests { @@ -13,7 +14,7 @@ protected override void ExploreAssembly(IProject testProject, IMetadataAssembly protected override string GetIdString(IUnitTestElement element) { - return string.Format("{0}::{1}::{2}", element.Id.Provider.ID, element.Id.PersistentProjectId.Id, element.Id.Id); + return string.Format("{0}::{1}::{2}", element.Id.Provider.ID, element.Id.GetPersistentProjectId(), element.Id.Id); } } } \ No newline at end of file diff --git a/resharper/test/src/tests/AcceptanceTests/XunitMetdataTestBase.9.2.cs b/resharper/test/src/tests/AcceptanceTests/XunitMetdataTestBase.9.2.cs new file mode 100644 index 0000000..53ceed5 --- /dev/null +++ b/resharper/test/src/tests/AcceptanceTests/XunitMetdataTestBase.9.2.cs @@ -0,0 +1,21 @@ +using System.Threading; +using JetBrains.Metadata.Reader.API; +using JetBrains.ProjectModel; +using JetBrains.ReSharper.UnitTestFramework; +using XunitContrib.Runner.ReSharper.UnitTestProvider; + +namespace XunitContrib.Runner.ReSharper.Tests.AcceptanceTests +{ + public abstract partial class XunitMetdataTestBase + { + protected override void ExploreAssembly(IProject testProject, IMetadataAssembly metadataAssembly, IUnitTestElementsObserver add) + { + GetMetdataExplorer().ExploreAssembly(testProject, metadataAssembly, add, CancellationToken.None); + } + + protected override string GetIdString(IUnitTestElement element) + { + return string.Format("{0}::{1}::{2}", element.Id.Provider.ID, element.Id.GetPersistentProjectId(), element.Id.Id); + } + } +} \ No newline at end of file diff --git a/resharper/test/src/tests/AcceptanceTests/XunitSourceTestBase.9.0.cs b/resharper/test/src/tests/AcceptanceTests/XunitSourceTestBase.9.0.cs index 6138309..f2ecaeb 100644 --- a/resharper/test/src/tests/AcceptanceTests/XunitSourceTestBase.9.0.cs +++ b/resharper/test/src/tests/AcceptanceTests/XunitSourceTestBase.9.0.cs @@ -21,7 +21,7 @@ protected override IUnitTestElementsSource FileExplorer protected override string GetIdString(IUnitTestElement element) { - return string.Format("{0}::{1}::{2}", element.Id.Provider.ID, element.Id.PersistentProjectId.Id, element.Id.Id); + return string.Format("{0}::{1}::{2}", element.Id.Provider.ID, element.Id.GetPersistentProjectId(), element.Id.Id); } } } \ No newline at end of file diff --git a/resharper/test/src/tests/packages.tests-rs92.config b/resharper/test/src/tests/packages.tests-rs92.config new file mode 100644 index 0000000..6eadaec --- /dev/null +++ b/resharper/test/src/tests/packages.tests-rs92.config @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resharper/test/src/tests/tests-rs82.csproj b/resharper/test/src/tests/tests-rs82.csproj index e7fa456..4d1410c 100644 --- a/resharper/test/src/tests/tests-rs82.csproj +++ b/resharper/test/src/tests/tests-rs82.csproj @@ -98,6 +98,7 @@ + diff --git a/resharper/test/src/tests/tests-rs90.csproj b/resharper/test/src/tests/tests-rs90.csproj index 34c9ba5..4a64703 100644 --- a/resharper/test/src/tests/tests-rs90.csproj +++ b/resharper/test/src/tests/tests-rs90.csproj @@ -81,6 +81,7 @@ + diff --git a/resharper/test/src/tests/tests-rs91.csproj b/resharper/test/src/tests/tests-rs91.csproj index 370037b..7c3d730 100644 --- a/resharper/test/src/tests/tests-rs91.csproj +++ b/resharper/test/src/tests/tests-rs91.csproj @@ -85,6 +85,7 @@ Code + diff --git a/resharper/test/src/tests/tests-rs92.csproj b/resharper/test/src/tests/tests-rs92.csproj new file mode 100644 index 0000000..d2d95a8 --- /dev/null +++ b/resharper/test/src/tests/tests-rs92.csproj @@ -0,0 +1,282 @@ + + + + Tests + True + 04799516 + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {61448A49-60C3-43B3-8F4F-F104BE14A427} + Library + Properties + XunitContrib.Runner.ReSharper.Tests + xunitcontrib.runner.resharper.tests.9.2 + v4.0 + 512 + + + + true + full + false + bin\rs92\Debug\ + JET_MODE_ASSERT;DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\rs92\Release\ + TRACE + prompt + 4 + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Code + + + + + + + + + + + + + + + False + PreserveNewest + + + + + + ..\..\..\packages\Antlr2.Runtime.2.7.7.02\lib\antlr.runtime.dll + + + False + ..\..\..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll + + + ..\..\..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.Data.v7.1.dll + True + + + ..\..\..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.Utils.v7.1.dll + True + + + ..\..\..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.XtraEditors.v7.1.dll + True + + + ..\..\..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.XtraTreeList.v7.1.dll + True + + + ..\..\..\packages\SharpZipLib.JetBrains.Stripped.0.86.20150204.1\lib\20\ICSharpCode.SharpZipLib.dll + True + + + False + ..\..\..\packages\DotNetZip.Reduced.1.9.1.8\lib\net20\Ionic.Zip.Reduced.dll + + + ..\..\..\packages\JetBrains.Unix.Utils.20150702.4\lib\net40\JbUnixUtils.dll + True + + + ..\..\..\packages\JetBrains.Annotations.9.1.1\lib\net20\JetBrains.Annotations.dll + True + + + False + ..\..\..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.Compression.Cab.2.0.20140304.0\lib\Microsoft.Deployment.Compression.dll + + + False + ..\..\..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.Compression.Cab.2.0.20140304.0\lib\Microsoft.Deployment.Compression.Cab.dll + + + ..\..\..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.WindowsInstaller.2.0.20140821.0\lib\Microsoft.Deployment.WindowsInstaller.dll + True + + + True + ..\..\..\packages\JetBrains.Platform.Lib.VisualStudio.AnyVs.ShellInterop.PrivateBuild.2.0.20140304.0\lib\Microsoft.VisualStudio.Shell.Interop.dll + + + False + ..\..\..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll + + + ..\..\..\packages\Windows7APICodePack.JetBrains.Stripped.1.1.20150225.0\lib\Net\Microsoft.WindowsAPICodePack.dll + True + + + ..\..\..\packages\Windows7APICodePack.JetBrains.Stripped.1.1.20150225.0\lib\Net\Microsoft.WindowsAPICodePack.Shell.dll + True + + + False + ..\..\..\packages\Newtonsoft35.Json.7.0.1\lib\net35\Newtonsoft.Json.dll + + + ..\..\..\packages\NuGet.Core.2.8.6\lib\net40-Client\NuGet.Core.dll + True + + + ..\..\..\packages\NUnit.Core.2.6.4\lib\nunit.core.dll + True + + + ..\..\..\packages\NUnit.Core.2.6.4\lib\nunit.core.interfaces.dll + True + + + ..\..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + True + + + ..\..\..\packages\NUnit.Core.2.6.4\lib\nunit.util.dll + True + + + ..\..\..\packages\NVelocity.1.0.3\lib\NVelocity.dll + + + + + ..\..\..\packages\Sprache.JetBrains.2.0.0.44\lib\portable-net4+netcore45+win8+wp8+sl5+MonoAndroid1+MonoTouch1\Sprache.dll + True + + + + + False + ..\..\..\packages\JetBrains.Platform.Lib.System.Windows.Interactivity.2.0.20140318.0\lib\System.Windows.Interactivity.dll + + + + + + ..\..\..\packages\Vestris.ResourceLib.JetBrains.1.4.20150303.0\lib\Net\Vestris.ResourceLib.dll + True + + + + ..\..\..\packages\JetBrains.Platform.Lib.WpfContrib.2.0.20150225.0\lib\Net\WpfContrib.dll + True + + + False + ..\..\..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll + + + + + {71819b7e-e124-44ce-9b92-60345a4a2856} + provider-rs92 + + + {a29f00fb-cec9-4fdc-8a0c-ce8d580b0fde} + runner-rs92 + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resharper/xunitcontrib-resharper.sln b/resharper/xunitcontrib-resharper.sln index 162bd7f..3ba489a 100644 --- a/resharper/xunitcontrib-resharper.sln +++ b/resharper/xunitcontrib-resharper.sln @@ -43,6 +43,19 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "provider-rs91", "src\provid EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests-rs91", "test\src\tests\tests-rs91.csproj", "{0E781020-0B81-4238-8FEA-408422A974B7}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "rs92", "rs92", "{0B8281C8-44E4-4A73-A5B3-9890E4048540}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "runner-rs92", "src\runner\runner-rs92.csproj", "{A29F00FB-CEC9-4FDC-8A0C-CE8D580B0FDE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "provider-rs92", "src\provider\provider-rs92.csproj", "{71819B7E-E124-44CE-9B92-60345A4A2856}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests-rs92", "test\src\tests\tests-rs92.csproj", "{61448A49-60C3-43B3-8F4F-F104BE14A427}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{D5CDDD58-747D-4F9C-BCF0-F84C1B34AA57}" + ProjectSection(SolutionItems) = preProject + .nuget\packages.config = .nuget\packages.config + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -85,6 +98,18 @@ Global {0E781020-0B81-4238-8FEA-408422A974B7}.Debug|Any CPU.Build.0 = Debug|Any CPU {0E781020-0B81-4238-8FEA-408422A974B7}.Release|Any CPU.ActiveCfg = Release|Any CPU {0E781020-0B81-4238-8FEA-408422A974B7}.Release|Any CPU.Build.0 = Release|Any CPU + {A29F00FB-CEC9-4FDC-8A0C-CE8D580B0FDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A29F00FB-CEC9-4FDC-8A0C-CE8D580B0FDE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A29F00FB-CEC9-4FDC-8A0C-CE8D580B0FDE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A29F00FB-CEC9-4FDC-8A0C-CE8D580B0FDE}.Release|Any CPU.Build.0 = Release|Any CPU + {71819B7E-E124-44CE-9B92-60345A4A2856}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {71819B7E-E124-44CE-9B92-60345A4A2856}.Debug|Any CPU.Build.0 = Debug|Any CPU + {71819B7E-E124-44CE-9B92-60345A4A2856}.Release|Any CPU.ActiveCfg = Release|Any CPU + {71819B7E-E124-44CE-9B92-60345A4A2856}.Release|Any CPU.Build.0 = Release|Any CPU + {61448A49-60C3-43B3-8F4F-F104BE14A427}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {61448A49-60C3-43B3-8F4F-F104BE14A427}.Debug|Any CPU.Build.0 = Debug|Any CPU + {61448A49-60C3-43B3-8F4F-F104BE14A427}.Release|Any CPU.ActiveCfg = Release|Any CPU + {61448A49-60C3-43B3-8F4F-F104BE14A427}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -101,5 +126,8 @@ Global {582DF029-F2A8-4777-847C-DFA8666FE901} = {5BC2ECDE-8768-4D0E-B0EC-75265EAC9AB9} {0C9D1414-7E76-42B2-B0A2-15AAA64405E5} = {5BC2ECDE-8768-4D0E-B0EC-75265EAC9AB9} {0E781020-0B81-4238-8FEA-408422A974B7} = {5BC2ECDE-8768-4D0E-B0EC-75265EAC9AB9} + {A29F00FB-CEC9-4FDC-8A0C-CE8D580B0FDE} = {0B8281C8-44E4-4A73-A5B3-9890E4048540} + {71819B7E-E124-44CE-9B92-60345A4A2856} = {0B8281C8-44E4-4A73-A5B3-9890E4048540} + {61448A49-60C3-43B3-8F4F-F104BE14A427} = {0B8281C8-44E4-4A73-A5B3-9890E4048540} EndGlobalSection EndGlobal From 6b44c5cbc5606e883b82647291b3927c25244fd3 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Wed, 5 Aug 2015 09:42:06 +0100 Subject: [PATCH 13/24] Disable shadow copy for tests The SDK's tests try to find the code base of the test runner as a relative path to the executing assembly codebase, which doesn't work if shadow copy is enabled. --- resharper/xunitcontrib-resharper.sln.DotSettings | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 resharper/xunitcontrib-resharper.sln.DotSettings diff --git a/resharper/xunitcontrib-resharper.sln.DotSettings b/resharper/xunitcontrib-resharper.sln.DotSettings new file mode 100644 index 0000000..340b3e4 --- /dev/null +++ b/resharper/xunitcontrib-resharper.sln.DotSettings @@ -0,0 +1,2 @@ + + False \ No newline at end of file From 327334be9f4cbd897e3006dd795489cfd746f9e9 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Wed, 5 Aug 2015 10:18:32 +0100 Subject: [PATCH 14/24] Added missing 9.1 SDK tests + updated to latest SDK --- .../Metadata/XunitMetadataTest.9.1.cs | 17 +---- .../AcceptanceTests/TestEnvironment.9.1.cs | 66 ------------------- .../test/src/tests/packages.tests-rs91.config | 30 +++++---- resharper/test/src/tests/tests-rs91.csproj | 60 ++++++++++------- 4 files changed, 56 insertions(+), 117 deletions(-) diff --git a/resharper/test/src/tests/AcceptanceTests/Metadata/XunitMetadataTest.9.1.cs b/resharper/test/src/tests/AcceptanceTests/Metadata/XunitMetadataTest.9.1.cs index ee2de4f..ddb8e7b 100644 --- a/resharper/test/src/tests/AcceptanceTests/Metadata/XunitMetadataTest.9.1.cs +++ b/resharper/test/src/tests/AcceptanceTests/Metadata/XunitMetadataTest.9.1.cs @@ -14,22 +14,7 @@ partial void InferProductHomeDir() // in TestCases, we fallback to the non-extension friendly implementation that expects // the source to be laid out as if we're building the product, not an extension, and it // requires Product.Root. We'll infer it instead. - var productHomeDir = - Environment.GetEnvironmentVariable(AllAssembliesLocator.ProductHomeDirEnvironmentVariableName); - if (string.IsNullOrEmpty(productHomeDir)) - { - var assembly = GetType().Assembly; - var productBinariesDir = assembly.GetPath().Parent; - if (AllAssembliesLocator.TryGetProductHomeDirOnSources(productBinariesDir).IsNullOrEmpty()) - { - var markerPath = TestUtil.GetTestDataPathBase_Find_FromAttr(assembly) ?? - TestUtil.DefaultTestDataPath; - var directoryNameOfItemAbove = FileSystemUtil.GetDirectoryNameOfItemAbove(productBinariesDir, - markerPath); - Environment.SetEnvironmentVariable(AllAssembliesLocator.ProductHomeDirEnvironmentVariableName, - directoryNameOfItemAbove.FullPath); - } - } + TestUtil.SetHomeDir(GetType().Assembly); } } } \ No newline at end of file diff --git a/resharper/test/src/tests/AcceptanceTests/TestEnvironment.9.1.cs b/resharper/test/src/tests/AcceptanceTests/TestEnvironment.9.1.cs index 3bf59c6..2d0075f 100644 --- a/resharper/test/src/tests/AcceptanceTests/TestEnvironment.9.1.cs +++ b/resharper/test/src/tests/AcceptanceTests/TestEnvironment.9.1.cs @@ -1,19 +1,7 @@ -using System; -using System.Collections.Generic; -using JetBrains.Application; -using JetBrains.Application.BuildScript.Application; using JetBrains.Application.BuildScript.Application.Zones; -using JetBrains.Application.BuildScript.PackageSpecification; -using JetBrains.Application.BuildScript.Solution; -using JetBrains.Application.Environment; -using JetBrains.Application.Environment.HostParameters; -using JetBrains.Metadata.Reader.API; -using JetBrains.Metadata.Utils; using JetBrains.ReSharper.TestFramework; using JetBrains.TestFramework; using JetBrains.TestFramework.Application.Zones; -using JetBrains.TestFramework.Utils; -using JetBrains.Util; using NUnit.Framework; namespace XunitContrib.Runner.ReSharper.Tests.AcceptanceTests @@ -26,59 +14,5 @@ public interface IXunitTestZone : ITestsZone, IRequire [SetUpFixture] public class TestEnvironmentAssembly : ExtensionTestEnvironmentAssembly { - // The default implementation of ExtensionTestEnvironmentAssembly breaks with multiple assemblies - protected override JetHostItems.Packages CreateJetHostPackages(JetHostItems.Engine engine) - { - var mainAssembly = GetType().Assembly; - var productBinariesDir = mainAssembly.GetPath().Parent; - - // Home dir - if (AllAssembliesLocator.TryGetProductHomeDirOnSources(productBinariesDir).IsNullOrEmpty()) - { - var relativeTestDataPath = TestUtil.GetTestDataPathBase_Find_FromAttr(mainAssembly) ?? TestUtil.DefaultTestDataPath; - var productHomeDir = FileSystemUtil.GetDirectoryNameOfItemAbove(productBinariesDir, relativeTestDataPath); - Environment.SetEnvironmentVariable(AllAssembliesLocator.ProductHomeDirEnvironmentVariableName, productHomeDir.FullPath); - } - - return engine.OnPackagesInFlatFolderDependentOnAssembly(mainAssembly, - packages => - { - var packageFiles = new HashSet(new JetBrains.EqualityComparer( - (file1, file2) => file1.LocalInstallPath == file2.LocalInstallPath, file => file.LocalInstallPath.GetHashCode())); - var packageReferences = new HashSet(new JetBrains.EqualityComparer( - (reference1, reference2) => string.Equals(reference1.PackageId, reference2.PackageId, StringComparison.OrdinalIgnoreCase), - reference => reference.PackageId.GetHashCode())); - var assemblyNameInfo = AssemblyNameInfo.Parse(mainAssembly.FullName); - using (var loader = new MetadataLoader(productBinariesDir)) - { - ProcessAssembly(packages, productBinariesDir, loader, assemblyNameInfo, packageFiles, packageReferences); - } - var packageArtifact = new ApplicationPackageArtifact(new SubplatformName(assemblyNameInfo.Name), new JetSemanticVersion(assemblyNameInfo.Version), CompanyInfo.Name, CompanyInfo.NameWithInc, DateTime.UtcNow, null, null, packageFiles, new JetPackageMetadata(), packageReferences, Guid.Empty); - return new AllAssembliesOnPackages(packages.Subplatforms.Concat(new SubplatformOnPackage(packageArtifact)).AsCollection()); - }); - } - - private static void ProcessAssembly(AllAssemblies allAssemblies, FileSystemPath productBinariesDir, MetadataLoader metadataLoader, AssemblyNameInfo assemblyNameInfo, HashSet packageFiles, HashSet packageReferences) - { - var assembly = metadataLoader.TryLoad(assemblyNameInfo, JetFunc.False, false); - if (assembly == null) return; - - var subplatformOfAssembly = allAssemblies.FindSubplatformOfAssembly(assemblyNameInfo, OnError.Ignore); - - if (subplatformOfAssembly != null) - { - var subplatformReference = new ApplicationPackageReference(subplatformOfAssembly.Name, subplatformOfAssembly.GetCompanyNameHuman()); - packageReferences.Add(subplatformReference); - return; - } - - if (!packageFiles.Add(new ApplicationPackageFile(assembly.Location.MakeRelativeTo(productBinariesDir), assemblyNameInfo))) - return; - - foreach (var referencedAssembly in assembly.ReferencedAssembliesNames) - { - ProcessAssembly(allAssemblies, productBinariesDir, metadataLoader, referencedAssembly, packageFiles, packageReferences); - } - } } } diff --git a/resharper/test/src/tests/packages.tests-rs91.config b/resharper/test/src/tests/packages.tests-rs91.config index cbd4575..4a7c441 100644 --- a/resharper/test/src/tests/packages.tests-rs91.config +++ b/resharper/test/src/tests/packages.tests-rs91.config @@ -6,25 +6,31 @@ - - - - - + + + + + + + - - - - - - + + + + + + + + + + - + diff --git a/resharper/test/src/tests/tests-rs91.csproj b/resharper/test/src/tests/tests-rs91.csproj index 7c3d730..7326d8b 100644 --- a/resharper/test/src/tests/tests-rs91.csproj +++ b/resharper/test/src/tests/tests-rs91.csproj @@ -1,9 +1,10 @@  + Tests True - 137ebd83 + 6bba7fb9 Debug @@ -156,6 +157,10 @@ False ..\..\..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.Compression.Cab.2.0.20140304.0\lib\Microsoft.Deployment.Compression.Cab.dll + + ..\..\..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.WindowsInstaller.2.0.20140821.0\lib\Microsoft.Deployment.WindowsInstaller.dll + True + True ..\..\..\packages\JetBrains.Platform.Lib.VisualStudio.AnyVs.ShellInterop.PrivateBuild.2.0.20140304.0\lib\Microsoft.VisualStudio.Shell.Interop.dll @@ -176,8 +181,8 @@ False ..\..\..\packages\Newtonsoft35.Json.7.0.1\lib\net35\Newtonsoft.Json.dll - - ..\..\..\packages\NuGet.Core.2.8.3\lib\net40-Client\NuGet.Core.dll + + ..\..\..\packages\NuGet.Core.2.8.5\lib\net40-Client\NuGet.Core.dll True @@ -243,27 +248,36 @@ - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + \ No newline at end of file From b860a74e59ad0ba3da6f527be7716bcfcdec948f Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Wed, 5 Aug 2015 10:59:47 +0100 Subject: [PATCH 15/24] Added SDK.Tests to 9.2 project --- resharper/test/src/tests/packages.tests-rs92.config | 1 + resharper/test/src/tests/tests-rs92.csproj | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/resharper/test/src/tests/packages.tests-rs92.config b/resharper/test/src/tests/packages.tests-rs92.config index 6eadaec..7abf05c 100644 --- a/resharper/test/src/tests/packages.tests-rs92.config +++ b/resharper/test/src/tests/packages.tests-rs92.config @@ -29,6 +29,7 @@ + diff --git a/resharper/test/src/tests/tests-rs92.csproj b/resharper/test/src/tests/tests-rs92.csproj index d2d95a8..8a00b4b 100644 --- a/resharper/test/src/tests/tests-rs92.csproj +++ b/resharper/test/src/tests/tests-rs92.csproj @@ -1,9 +1,10 @@  + Tests True - 04799516 + 60026be0 Debug @@ -260,6 +261,7 @@ + @@ -279,4 +281,4 @@ - + \ No newline at end of file From f124b6ca304054feccedc19396ab40ee7ff3ad24 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Wed, 5 Aug 2015 11:31:57 +0100 Subject: [PATCH 16/24] 9.2 testing requires STA Not sure if this is a new requirement or oversight... --- .../test/src/tests/AcceptanceTests/TestEnvironment.9.2.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resharper/test/src/tests/AcceptanceTests/TestEnvironment.9.2.cs b/resharper/test/src/tests/AcceptanceTests/TestEnvironment.9.2.cs index 2d0075f..e0e7a87 100644 --- a/resharper/test/src/tests/AcceptanceTests/TestEnvironment.9.2.cs +++ b/resharper/test/src/tests/AcceptanceTests/TestEnvironment.9.2.cs @@ -4,6 +4,9 @@ using JetBrains.TestFramework.Application.Zones; using NUnit.Framework; +// Hmm. 9.2 seems to require STA - ShellLocks asserts if we're not. I don't know why, yet. +[assembly: RequiresSTA] + namespace XunitContrib.Runner.ReSharper.Tests.AcceptanceTests { [ZoneDefinition] From 65046b81a54bd40b0969aec67dae88c163107f4b Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Wed, 5 Aug 2015 12:02:07 +0100 Subject: [PATCH 17/24] Remove pure attribute from asserts IsType and IsAssignableFrom return values, but it's not an error to ignore the return value. Fixes #69 --- resharper/ExternalAnnotations/xunit.assert.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/resharper/ExternalAnnotations/xunit.assert.xml b/resharper/ExternalAnnotations/xunit.assert.xml index 2b5617c..792f4b7 100644 --- a/resharper/ExternalAnnotations/xunit.assert.xml +++ b/resharper/ExternalAnnotations/xunit.assert.xml @@ -686,7 +686,6 @@ - @@ -742,7 +741,6 @@ - From e73d6a38749f8b6f3f5dd4210324b889a8cabb73 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Wed, 5 Aug 2015 12:29:45 +0100 Subject: [PATCH 18/24] 9.2 nuspec Fixes #63 --- resharper/nuget/pack-rs92.bat | 1 + resharper/nuget/xunitcontrib-rs92.nuspec | 66 ++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 resharper/nuget/pack-rs92.bat create mode 100644 resharper/nuget/xunitcontrib-rs92.nuspec diff --git a/resharper/nuget/pack-rs92.bat b/resharper/nuget/pack-rs92.bat new file mode 100644 index 0000000..8979ca6 --- /dev/null +++ b/resharper/nuget/pack-rs92.bat @@ -0,0 +1 @@ +nuget pack xunitcontrib-rs92.nuspec diff --git a/resharper/nuget/xunitcontrib-rs92.nuspec b/resharper/nuget/xunitcontrib-rs92.nuspec new file mode 100644 index 0000000..1caa2a9 --- /dev/null +++ b/resharper/nuget/xunitcontrib-rs92.nuspec @@ -0,0 +1,66 @@ + + + + CitizenMatt.Xunit + xUnit.net Test Support for ReSharper 9 + 2.2.7-beta-20150805 + Matt Ellis + Matt Ellis + A unit test provider for xUnit.net. Discovers and runs xUnit.net 1.x and 2.0 tests. Includes annotations to aid ReSharper inspections and Live Templates to speed up inserting test methods and asserts. + A unit test provider for xUnit.net + +• Support for ReSharper 9.2 EAP7 (#63) +• Assert.IsType and Assert.IsAssignableFrom are no longer marked as pure methods (#69) + +From previous builds: +• Don't crash if we get badly formatted exception data from xunit1 (#50) +• Support for xunit 2.0 +• Rewritten the core runner to be more robust with multi-threading. Should fix issues with aborted or inconclusive tests (#44, #31) +• Updated external annotations for xunit 2.0 (#30) +• Read xunit 2.0 settings from config file (#40) +• Added logging for ReSharper 9 in internal mode +• Report diagnostic messages when 'xunit.diagnosticMessages' is set in config (#28) +• Report mismatched pre-release versions on failure (#23) +• Fixed crash working with xUnit.net 1.1 +• Fixed an issue (#9) to run individual methods, rather than all methods in the class +• Fixed an issue (#21) with Unicode characters in display names and data attributes +• Captures output from ITestOutputHelper +• Shadow copy cache clean up on abort +• Parallelisation re-enabled! + +Known issues: +• Live Templates for Theory use xunit1 namespace + https://github.com/xunit/resharper-xunit + https://raw.githubusercontent.com/xunit/resharper-xunit/xunit2/license.txt + https://raw.githubusercontent.com/xunit/media/master/logo-512-transparent.png + Copyright 2014 Matt Ellis + false + + + + resharper unittest xunit + + + + + + + + + + + + + + + + From c539f0799622f6b1de15a75cd15887ce40950ccf Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Fri, 7 Aug 2015 17:03:03 +0100 Subject: [PATCH 19/24] Nicer log messages --- resharper/src/runner/Discoverer.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/resharper/src/runner/Discoverer.cs b/resharper/src/runner/Discoverer.cs index dcef71f..bcf0ebf 100644 --- a/resharper/src/runner/Discoverer.cs +++ b/resharper/src/runner/Discoverer.cs @@ -91,14 +91,14 @@ private bool IsRequestedMethod(ITestCase testCase) if (IsTheory(displayName, typeName, methodName)) { var hasTheoryTask = runContext.HasTheoryTask(displayName, typeName, methodName); - Logger.LogVerbose(" Theory test case is {0}a requested theory: {1}", + Logger.LogVerbose(" Test case is a theory, has {0}been previously seen: {1}", hasTheoryTask ? string.Empty : "NOT ", testCase.Format()); return hasTheoryTask; } var hasMethodTask = runContext.HasMethodTask(typeName, methodName); - Logger.LogVerbose(" Test case is {0}a requested method: {1}", hasMethodTask ? string.Empty : "NOT ", + Logger.LogVerbose(" Test case is a method, is {0}requested: {1}", hasMethodTask ? string.Empty : "NOT ", testCase.Format()); return hasMethodTask; } @@ -119,7 +119,7 @@ private bool IsDynamicMethod(ITestCase testCase) if (classTaskWrapper == null) { Logger.LogVerbose( - " Test case class unknown. Cannot be a dynamic test of a requested class. {0} - {1}", + " Test case does not belong to a known class. Cannot be a dynamic test of a requested class. {0} - {1}", testCase.TestMethod.TestClass.Class.Name, testCase.Format()); return false; } @@ -129,9 +129,8 @@ private bool IsDynamicMethod(ITestCase testCase) if (IsTheory(displayName, typeName, methodName)) { var isDynamicTheory = !classTask.IsKnownMethod(displayName.Replace(typeName + ".", string.Empty)); - Logger.LogVerbose(" Theory test case is {0}a requested theory: {1}", - isDynamicTheory ? string.Empty : "NOT ", - testCase.Format()); + Logger.LogVerbose(" Test case is a previously unseen (dynamic) theory, {0} to a requested method: {1}", + isDynamicTheory ? "belongs" : "does NOT belong", testCase.Format()); return isDynamicTheory; } From df95a206478edf8d3e39a0dd16f653b5fd804d58 Mon Sep 17 00:00:00 2001 From: Matt Ellis Date: Thu, 13 Aug 2015 23:31:55 +0100 Subject: [PATCH 20/24] 9.2 RC2 support --- resharper/nuget/xunitcontrib-rs92.nuspec | 4 +- .../provider/packages.provider-rs92.config | 43 ++++++----- resharper/src/provider/provider-rs92.csproj | 74 +++++++++---------- .../src/runner/packages.runner-rs92.config | 43 ++++++----- resharper/src/runner/runner-rs92.csproj | 74 +++++++++---------- .../AcceptanceTests/TestEnvironment.9.2.cs | 2 +- .../test/src/tests/packages.tests-rs92.config | 43 ++++++----- resharper/test/src/tests/tests-rs92.csproj | 74 +++++++++---------- 8 files changed, 183 insertions(+), 174 deletions(-) diff --git a/resharper/nuget/xunitcontrib-rs92.nuspec b/resharper/nuget/xunitcontrib-rs92.nuspec index 1caa2a9..ef20fd1 100644 --- a/resharper/nuget/xunitcontrib-rs92.nuspec +++ b/resharper/nuget/xunitcontrib-rs92.nuspec @@ -3,13 +3,13 @@ CitizenMatt.Xunit xUnit.net Test Support for ReSharper 9 - 2.2.7-beta-20150805 + 2.2.7 Matt Ellis Matt Ellis A unit test provider for xUnit.net. Discovers and runs xUnit.net 1.x and 2.0 tests. Includes annotations to aid ReSharper inspections and Live Templates to speed up inserting test methods and asserts. A unit test provider for xUnit.net -• Support for ReSharper 9.2 EAP7 (#63) +• Support for ReSharper 9.2 (#63) • Assert.IsType and Assert.IsAssignableFrom are no longer marked as pure methods (#69) From previous builds: diff --git a/resharper/src/provider/packages.provider-rs92.config b/resharper/src/provider/packages.provider-rs92.config index 6eadaec..6f07354 100644 --- a/resharper/src/provider/packages.provider-rs92.config +++ b/resharper/src/provider/packages.provider-rs92.config @@ -1,35 +1,37 @@  - + - - - - - - + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -39,7 +41,8 @@ - + + diff --git a/resharper/src/provider/provider-rs92.csproj b/resharper/src/provider/provider-rs92.csproj index 59bb55e..1e4cf11 100644 --- a/resharper/src/provider/provider-rs92.csproj +++ b/resharper/src/provider/provider-rs92.csproj @@ -13,7 +13,7 @@ v4.0 512 - 0ed3b45b + ea21b3b8 true @@ -237,47 +237,47 @@ + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +