Skip to content

APIs to restore before 3.11 #3032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
28 tasks done
jnm2 opened this issue Sep 29, 2018 · 4 comments
Closed
28 tasks done

APIs to restore before 3.11 #3032

jnm2 opened this issue Sep 29, 2018 · 4 comments
Assignees
Labels
pri:critical Use this to indicate a hotfix may be necessary
Milestone

Comments

@jnm2
Copy link
Contributor

jnm2 commented Sep 29, 2018

Diffed 3.10.1 and master. These APIs had breaking changes to revert from #2796 before 3.11 is released:

  • IFixtureBuilder.BuildFrom (keep new IFixtureBuilder2 consistent)
  • IFixtureBuilder2.BuildFrom
  • IMethodInfo (undelete)
  • IParameterDataProvider.GetData
  • IParameterDataSource.GetData
  • IParameterInfo (undelete)
  • IReflectionInfo (undelete)
  • ISuiteBuilder.BuildFrom (2)
  • ISuiteBuilder.CanBuildFrom
  • ITest.Method
  • ITest.TypeInfo (incl rename)
  • ITestBuilder.BuildFrom
  • ITestCaseBuilder.BuildFrom
  • ITestCaseBuilder.CanBuildFrom
  • ITypeInfo (undelete)

Should be covered by the above:

  • RandomAttribute.GetData
  • RangeAttribute.GetData
  • SetUpFixtureAttribute.BuildFrom
  • TestAttribute.BuildFrom
  • TestCaseAttribute.BuildFrom
  • TestCaseSourceAttribute.BuildFrom
  • TestFixtureAttribute.BuildFrom (2)
  • TestFixtureSourceAttribute.BuildFrom (2)
  • ValueSourceAttribute.GetData
  • ValuesAttribute.GetData
  • Test.Method (undelete)
  • Test.TypeInfo (incl rename)

Do not restore:

  • Test.DeclaringTypeInfo (mutable protected field in Internal namespace)
@jnm2 jnm2 added the pri:critical Use this to indicate a hotfix may be necessary label Sep 29, 2018
@jnm2 jnm2 added this to the 3.11 milestone Sep 29, 2018
@jnm2 jnm2 self-assigned this Sep 29, 2018
@jnm2
Copy link
Contributor Author

jnm2 commented Sep 29, 2018

@CharliePoole Would you want to take this opportunity to change the IPrefilter.IsMatch overloads from Type type and Type type, MethodInfo method to ITypeInfo typeInfo and ITypeInfo typeInfo, IMethodInfo method?

@CharliePoole
Copy link
Member

Do you see an advantage to that? As currently defined users make use of well-known .NET Types and it's up to us to implement it.

@jnm2
Copy link
Contributor Author

jnm2 commented Sep 29, 2018

@CharliePoole Consistency with the other interfaces is the only reason I can think of. We don't expect users to implement IMethodInfo and therefore I can't think of any inherent reason that it would be better.

@jnm2
Copy link
Contributor Author

jnm2 commented Sep 29, 2018

@nunit/framework-team This is our net45 framework diff from 3.10.1 to 3.11.0, after restoring the ITypeInfo API in #3033:

namespace NUnit.Compatibility
{
-   public static class AdditionalTypeExtensions
-   {
-       public static bool IsCastableFrom(this System.Type to, System.Type from);

-       public static bool ParametersMatch(this System.Reflection.ParameterInfo[] pinfos, System.Type[] ptypes);
-   }

-   public static class MemberInfoExtensions
-   {
-       public static System.Collections.Generic.IEnumerable<T> GetAttributes<T>(this System.Reflection.MemberInfo info, bool inherit) where T : class;

-       public static System.Collections.Generic.IEnumerable<T> GetAttributes<T>(this System.Reflection.ParameterInfo info, bool inherit) where T : class;

-       public static System.Collections.Generic.IEnumerable<T> GetAttributes<T>(this System.Reflection.Assembly asm) where T : class;
-   }

-   public class NUnitNullType
-   {
-       public NUnitNullType();
-   }
}
namespace NUnit.Framework
{
-   public class CollectionAssert
+   public abstract class CollectionAssert
    {
-       public CollectionAssert();
+       protected CollectionAssert();
    }
    
-   public class Contains
+   public abstract class Contains
    {
-       public Contains();
+       protected Contains();
    }

+   [System.Obsolete("Holdover from NUnit v2. Please implement IParameterDataSource for your attribute instead.")]
    public abstract class DataAttribute : NUnitAttribute
    {
    }
    
-   public class Does
+   public abstract class Does
    {
-       public Does();
+       protected Does();
    }
    
-   public class Has
+   public abstract class Has
    {
-       public Has();
+       protected Has();
    }
    
-   public class Is
+   public abstract class Is
    {
-       public Is();
+       protected Is();
    }
    
-   public class Iz : Is
+   public abstract class Iz
    {
-       public Iz();
+       protected Iz();
    }

-   public class RandomAttribute : DataAttribute, NUnit.Framework.Interfaces.IParameterDataSource
+   public class RandomAttribute : NUnitAttribute, NUnit.Framework.Interfaces.IParameterDataSource
    {
    }

-   public class RangeAttribute : DataAttribute, NUnit.Framework.Interfaces.IParameterDataSource
+   public class RangeAttribute : NUnitAttribute, NUnit.Framework.Interfaces.IParameterDataSource
    {
    }

-   public class RepeatAttribute : PropertyAttribute, NUnit.Framework.Interfaces.IWrapSetUpTearDown, NUnit.Framework.Interfaces.ICommandWrapper
+   public class RepeatAttribute : PropertyAttribute, NUnit.Framework.Interfaces.IRepeatTest, NUnit.Framework.Interfaces.ICommandWrapper
    {
    }

-   public class RetryAttribute : PropertyAttribute, NUnit.Framework.Interfaces.IWrapSetUpTearDown, NUnit.Framework.Interfaces.ICommandWrapper
+   public class RetryAttribute : PropertyAttribute, NUnit.Framework.Interfaces.IRepeatTest, NUnit.Framework.Interfaces.ICommandWrapper
    {
    }
    
-   public class StringAssert
+   public abstract class StringAssert
    {
-       public StringAssert();
+       protected StringAssert();
    }

    public class TestCaseData : NUnit.Framework.Internal.TestCaseParameters
    {
+       public TestCaseData SetArgDisplayNames(params string[] displayNames);
    }
    
-   public class TestFixtureAttribute : NUnitAttribute, NUnit.Framework.Interfaces.IFixtureBuilder, NUnit.Framework.Interfaces.ITestFixtureData, NUnit.Framework.Interfaces.ITestData
+   public class TestFixtureAttribute : NUnitAttribute, NUnit.Framework.Interfaces.IFixtureBuilder2, NUnit.Framework.Interfaces.IFixtureBuilder, NUnit.Framework.Interfaces.ITestFixtureData, NUnit.Framework.Interfaces.ITestData
    {
+       public System.Collections.Generic.IEnumerable<NUnit.Framework.Internal.TestSuite> BuildFrom(NUnit.Framework.Interfaces.ITypeInfo typeInfo, NUnit.Framework.Interfaces.IPreFilter filter);
    }

    public class TestFixtureData : NUnit.Framework.Internal.TestFixtureParameters
    {
+       public TestFixtureData SetArgDisplayNames(params string[] displayNames);
    }
    
-   public class TestFixtureSourceAttribute : NUnitAttribute, NUnit.Framework.Interfaces.IFixtureBuilder
+   public class TestFixtureSourceAttribute : NUnitAttribute, NUnit.Framework.Interfaces.IFixtureBuilder2, NUnit.Framework.Interfaces.IFixtureBuilder
    {
+       public System.Collections.Generic.IEnumerable<NUnit.Framework.Internal.TestSuite> BuildFrom(NUnit.Framework.Interfaces.ITypeInfo typeInfo, NUnit.Framework.Interfaces.IPreFilter filter);
    }
    
-   public class Throws
+   public abstract class Throws
    {
-       public Throws();
+       protected Throws();
    }

-   public class ValueSourceAttribute : DataAttribute, NUnit.Framework.Interfaces.IParameterDataSource
+   public class ValueSourceAttribute : NUnitAttribute, NUnit.Framework.Interfaces.IParameterDataSource
    {
    }

-   public class ValuesAttribute : DataAttribute, NUnit.Framework.Interfaces.IParameterDataSource
+   public class ValuesAttribute : NUnitAttribute, NUnit.Framework.Interfaces.IParameterDataSource
    {
    }
}
namespace NUnit.Framework.Api
{
    public class DefaultTestAssemblyBuilder : ITestAssemblyBuilder
    {
-       public NUnit.Framework.Interfaces.ITest Build(string assemblyName, System.Collections.Generic.IDictionary<string, object> options);
+       public NUnit.Framework.Interfaces.ITest Build(string assemblyNameOrPath, System.Collections.Generic.IDictionary<string, object> options);
    }

    public class NUnitTestAssemblyRunner : ITestAssemblyRunner
    {
-       public NUnit.Framework.Interfaces.ITest Load(string assemblyName, System.Collections.Generic.IDictionary<string, object> settings);
+       public NUnit.Framework.Interfaces.ITest Load(string assemblyNameOrPath, System.Collections.Generic.IDictionary<string, object> settings);
    }
}
namespace NUnit.Framework.Constraints
{
    public abstract class CollectionItemsEqualConstraint : CollectionConstraint
    {
-       public CollectionItemsEqualConstraint Using<T>(System.Comparison<T> comparer);
+       public CollectionItemsEqualConstraint Using<T>(System.Comparison<T> comparison);
    }

-   public class CollectionTally
+   public sealed class CollectionTally
    {
-       public class CollectionTallyResult
+       public sealed class CollectionTallyResult
        {
-           public System.Collections.Generic.List<object> ExtraItems { get; set; }
+           public System.Collections.Generic.List<object> ExtraItems { get; }

-           public System.Collections.Generic.List<object> MissingItems { get; set; }
+           public System.Collections.Generic.List<object> MissingItems { get; }

-           public CollectionTallyResult();
+           public CollectionTallyResult(System.Collections.Generic.List<object> missingItems, System.Collections.Generic.List<object> extraItems);
        }
    }

-   public class ConstraintBuilder : IResolveConstraint
+   public class ConstraintBuilder : IResolveConstraint
    {
-       public class ConstraintStack
+       public sealed class ConstraintStack
        {
        }

-       public class OperatorStack
-       {
-           public bool Empty { get; }

-           public ConstraintOperator Top { get; }

-           public OperatorStack(ConstraintBuilder builder);

-           public ConstraintOperator Pop();

-           public void Push(ConstraintOperator op);
-       }
    }
    
    public class ConstraintExpression
    {
-       protected ConstraintBuilder builder;
+       protected readonly ConstraintBuilder builder;

-       public Constraint AnyOf(params object[] expected);
+       public AnyOfConstraint AnyOf(params object[] expected);
    }

    public class ConstraintResult
    {
+       public virtual void WriteAdditionalLinesTo(MessageWriter writer);
    }

    public class DictionaryContainsKeyConstraint : CollectionItemsEqualConstraint
    {
+       [System.Obsolete("DictionaryContainsKeyConstraint now uses the comparer which the dictionary is based on. To test using a comparer which the dictionary is not based on, use a collection constraint on the set of keys.")]
+       public new CollectionItemsEqualConstraint IgnoreCase { get; }

+       [System.Obsolete("DictionaryContainsKeyConstraint now uses the comparer which the dictionary is based on. To test using a comparer which the dictionary is not based on, use a collection constraint on the set of keys.")]
+       public new CollectionItemsEqualConstraint Using(System.Collections.IComparer comparer);

+       [System.Obsolete("DictionaryContainsKeyConstraint now uses the comparer which the dictionary is based on. To test using a comparer which the dictionary is not based on, use a collection constraint on the set of keys.")]
+       public new CollectionItemsEqualConstraint Using(System.Collections.IEqualityComparer comparer);

+       [System.Obsolete("DictionaryContainsKeyConstraint now uses the comparer which the dictionary is based on. To test using a comparer which the dictionary is not based on, use a collection constraint on the set of keys.")]
+       public new CollectionItemsEqualConstraint Using<T>(System.Comparison<T> comparison);

+       [System.Obsolete("DictionaryContainsKeyConstraint now uses the comparer which the dictionary is based on. To test using a comparer which the dictionary is not based on, use a collection constraint on the set of keys.")]
+       public new CollectionItemsEqualConstraint Using<T>(System.Collections.Generic.IComparer<T> comparer);

+       [System.Obsolete("DictionaryContainsKeyConstraint now uses the comparer which the dictionary is based on. To test using a comparer which the dictionary is not based on, use a collection constraint on the set of keys.")]
+       public new CollectionItemsEqualConstraint Using<T>(System.Collections.Generic.IEqualityComparer<T> comparer);

+       [System.Obsolete("DictionaryContainsKeyConstraint now uses the comparer which the dictionary is based on. To test using a comparer which the dictionary is not based on, use a collection constraint on the set of keys.")]
+       public new CollectionItemsEqualConstraint Using<T>(System.Func<T, T, bool> comparer);

+       [System.Obsolete("DictionaryContainsKeyConstraint now uses the comparer which the dictionary is based on. To test using a comparer which the dictionary is not based on, use a collection constraint on the set of keys.")]
+       public new DictionaryContainsKeyConstraint Using<TCollectionType, TMemberType>(System.Func<TCollectionType, TMemberType, bool> comparison);
    }

-   public class FloatingPointNumerics
-   {
-       public static bool AreAlmostEqualUlps(float left, float right, int maxUlps);

-       public static bool AreAlmostEqualUlps(double left, double right, long maxUlps);

-       public static double ReinterpretAsDouble(long value);

-       public static float ReinterpretAsFloat(int value);

-       public static int ReinterpretAsInt(float value);

-       public static long ReinterpretAsLong(double value);
-   }

-   public class Interval
+   public sealed class Interval
    {
    }

-   public class NUnitComparer : System.Collections.IComparer
+   public sealed class NUnitComparer : System.Collections.IComparer
    {
-       public class FailurePoint
+       public sealed class FailurePoint
        {
        }
    }
    
-   public sealed class Tolerance
+   public sealed class Tolerance
    {
-       public class Range
+       public struct Range
        {
        }
    }
}
namespace NUnit.Framework.Interfaces
{
+   public interface IFixtureBuilder2 : IFixtureBuilder
+   {
+       System.Collections.Generic.IEnumerable<NUnit.Framework.Internal.TestSuite> BuildFrom(ITypeInfo typeInfo, IPreFilter filter);
+   }

+   public interface IPreFilter
+   {
+       bool IsMatch(System.Type type);

+       bool IsMatch(System.Type type, System.Reflection.MethodInfo method);
+   }

    public interface IReflectionInfo
    {
-       bool IsDefined<T>(bool inherit);
+       bool IsDefined<T>(bool inherit) where T : class;
    }

+   public interface IRepeatTest : ICommandWrapper
+   {
+   }

    public interface ISuiteBuilder
    {
+       NUnit.Framework.Internal.TestSuite BuildFrom(ITypeInfo typeInfo, IPreFilter filter);
    }

    public interface ITestListener
    {
+       void SendMessage(TestMessage message);
    }

+   [System.Diagnostics.DebuggerDisplay("{ToString(),nq}")]
+   public sealed class TestMessage
+   {
+       public string Destination { get; }

+       public string Message { get; }

+       public string TestId { get; }

+       public TestMessage(string destination, string text, string testId);

+       public override string ToString();

+       public string ToXml();
+   }
}
namespace NUnit.Framework.Internal
{
    // Warning; type cannot be ignored because it is referenced by:
    //  - NUnit.Framework.Internal.TestMethod base type
    //  - NUnit.Framework.Internal.Commands.TestCommand.get_Test return type
    //  - NUnit.Framework.Internal.TestSuite base type
    //  - NUnit.Framework.Interfaces.ITestCaseBuilder.BuildFrom return type
    public abstract class Test : NUnit.Framework.Interfaces.ITest, NUnit.Framework.Interfaces.IXmlNodeBuilder, System.IComparable
    {
+       protected NUnit.Framework.Interfaces.ITypeInfo DeclaringTypeInfo;
    }
    
    // Warning; type cannot be ignored because it is referenced by:
    //  - NUnit.Framework.SetUpFixtureAttribute.BuildFrom return type
    //  - NUnit.Framework.TestFixtureAttribute.BuildFrom return type
+   //  - NUnit.Framework.TestFixtureAttribute.BuildFrom return type
    //  - NUnit.Framework.TestFixtureSourceAttribute.BuildFrom return type
+   //  - NUnit.Framework.TestFixtureSourceAttribute.BuildFrom return type
    //  - NUnit.Framework.Interfaces.IFixtureBuilder.BuildFrom return type
+   //  - NUnit.Framework.Interfaces.IFixtureBuilder2.BuildFrom return type
+   //  - NUnit.Framework.Interfaces.ISuiteBuilder.BuildFrom return type
    //  - NUnit.Framework.Interfaces.ISuiteBuilder.BuildFrom return type
    public class TestSuite : Test
    {
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pri:critical Use this to indicate a hotfix may be necessary
Projects
None yet
Development

No branches or pull requests

2 participants