-
Notifications
You must be signed in to change notification settings - Fork 763
Closed
Description
Using nunit.framework 3.2 and nunit3-console 3.0.1.
Code:
using NUnit.Framework;
namespace NUnitHasProperty
{
public interface IFoo
{
string Description { get; }
}
public class ImplicitFoo : IFoo
{
public string Description => "Foo";
}
public class ExplicitFoo : IFoo
{
string IFoo.Description => "Foo";
}
[TestFixture(typeof(ImplicitFoo))]
[TestFixture(typeof(ExplicitFoo))]
public class HasPropertyTestCase<TFoo>
where TFoo : IFoo, new()
{
[Test]
public void DescriptionIsFoo()
{
IFoo thing = new TFoo();
Assert.That(thing, Has.Property(nameof(IFoo.Description)).EqualTo("Foo"));
}
}
}
Results:
NUnit Console Runner 3.0.5813
Copyright (C) 2015 Charlie Poole
Runtime Environment
OS Version: Microsoft Windows NT 10.0.10240.0
CLR Version: 4.0.30319.42000
Test Files
NUnitHasProperty.dll
Errors and Failures
1) Error : NUnitHasProperty.HasPropertyTestCase<ExplicitFoo>.DescriptionIsFoo
System.ArgumentException : Property Description was not found
Parameter name: name
at NUnit.Framework.Constraints.PropertyConstraint.ApplyTo[TActual](TActual actual)
at NUnit.Framework.Assert.That[TActual](TActual actual, IResolveConstraint expression, String message, Object[] args)
at NUnit.Framework.Assert.That[TActual](TActual actual, IResolveConstraint expression)
at NUnitHasProperty.HasPropertyTestCase`1.DescriptionIsFoo() in C:\temp\NUnitHasProperty\NUnitHasProperty\HasPropertyTestCase.cs:line 29
Run Settings
WorkDirectory: C:\temp\NUnitHasProperty\NUnitHasProperty\bin\Debug
NumberOfTestWorkers: 12
Test Run Summary
Overall result: Failed
Tests run: 2, Passed: 1, Errors: 1, Failures: 0, Inconclusive: 0
Not run: 0, Invalid: 0, Ignored: 0, Explicit: 0, Skipped: 0
Start time: 2016-04-06 04:58:54Z
End time: 2016-04-06 04:58:54Z
Duration: 0.085 seconds
Results (nunit3) saved as TestResult.xml
Reactions are currently unavailable