Run unit tests during builds
- add "test" command - use latest (forked) XUnit packages update package references [PropertyData] -> [MemberData] Xunit.Extensions -> Xunit or Xunit.SDK Moq now available for .NET 4.5 only - delete a couple of unit tests checking for ArgumentNullException - provide TestCommon classes in Razor and Razor.Host test projects - make ReplaceCulture internal because it's a shared source
This commit is contained in:
parent
f8179f03e4
commit
ed1b2ddcc3
|
|
@ -4,15 +4,6 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Test
|
|||
{
|
||||
public class ComplexModelDtoResultTest
|
||||
{
|
||||
[Fact]
|
||||
public void Constructor_ThrowsIfValidationNodeIsNull()
|
||||
{
|
||||
// Act & assert
|
||||
ExceptionAssert.ThrowsArgumentNull(
|
||||
() => new ComplexModelDtoResult("some string", validationNode: null),
|
||||
"validationNode");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_SetsProperties()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xunit;
|
||||
using Xunit.Extensions;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.ModelBinding.Internal.Test
|
||||
{
|
||||
|
|
@ -50,7 +49,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding.Internal.Test
|
|||
}
|
||||
|
||||
[Theory]
|
||||
[PropertyData("TypesWithValues")]
|
||||
[MemberData("TypesWithValues")]
|
||||
public void IsCompatibleWithReturnsTrue_IfValueIsAssignable(Type type, object value)
|
||||
{
|
||||
// Act
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
using Xunit.Extensions;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.ModelBinding.Test
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using System.Linq;
|
|||
using Moq;
|
||||
using Moq.Protected;
|
||||
using Xunit;
|
||||
using Xunit.Extensions;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.ModelBinding
|
||||
{
|
||||
|
|
@ -58,7 +57,7 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
|||
}
|
||||
|
||||
[Theory]
|
||||
[PropertyData("ValidateSetsMemberNamePropertyDataSet")]
|
||||
[MemberData("ValidateSetsMemberNamePropertyDataSet")]
|
||||
public void ValidateSetsMemberNamePropertyOfValidationContextForProperties(ModelMetadata metadata, string expectedMemberName)
|
||||
{
|
||||
// Arrange
|
||||
|
|
|
|||
|
|
@ -7,15 +7,6 @@ namespace Microsoft.AspNet.Mvc.ModelBinding
|
|||
{
|
||||
private readonly DataAnnotationsModelMetadataProvider _metadataProvider = new DataAnnotationsModelMetadataProvider();
|
||||
|
||||
[Fact]
|
||||
public void ConstructorGuards()
|
||||
{
|
||||
// Act and Assert
|
||||
ExceptionAssert.ThrowsArgumentNull(
|
||||
() => new ErrorModelValidator(errorMessage: null),
|
||||
"errorMessage");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ValidateThrowsException()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,14 +5,21 @@
|
|||
"Microsoft.AspNet.PipelineCore": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.Mvc.ModelBinding" : "",
|
||||
"TestCommon" : "",
|
||||
"Moq": "4.0.10827",
|
||||
"Xunit": "1.9.1",
|
||||
"Xunit.extensions": "1.9.1"
|
||||
"Xunit.KRunner": "0.1-alpha-*",
|
||||
"xunit.abstractions": "2.0.0-aspnet-*",
|
||||
"xunit.assert": "2.0.0-aspnet-*",
|
||||
"xunit.core": "2.0.0-aspnet-*",
|
||||
"xunit.execution": "2.0.0-aspnet-*"
|
||||
},
|
||||
"commands": {
|
||||
"test": "Xunit.KRunner"
|
||||
},
|
||||
"configurations": {
|
||||
"net45": {
|
||||
dependencies: {
|
||||
"Moq": "4.2.1312.1622",
|
||||
"System.ComponentModel.DataAnnotations": "",
|
||||
"System.Reflection": "",
|
||||
"System.Runtime.Serialization": ""
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,11 +3,22 @@
|
|||
"dependencies": {
|
||||
"Microsoft.AspNet.Razor" : "0.1-alpha-*",
|
||||
"Microsoft.AspNet.Mvc.Razor.Host" : "",
|
||||
"Moq": "4.0.10827",
|
||||
"Xunit": "1.9.1",
|
||||
"Xunit.extensions": "1.9.1"
|
||||
"TestCommon" : "",
|
||||
"Xunit.KRunner": "0.1-alpha-*",
|
||||
"xunit.abstractions": "2.0.0-aspnet-*",
|
||||
"xunit.assert": "2.0.0-aspnet-*",
|
||||
"xunit.core": "2.0.0-aspnet-*",
|
||||
"xunit.execution": "2.0.0-aspnet-*"
|
||||
},
|
||||
"commands": {
|
||||
"test": "Xunit.KRunner"
|
||||
},
|
||||
"configurations": {
|
||||
"net45": { }
|
||||
"net45": {
|
||||
"dependencies": {
|
||||
"Moq": "4.2.1312.1622",
|
||||
"System.Reflection": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ using Microsoft.AspNet.Razor.Generator.Compiler;
|
|||
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
|
||||
using Microsoft.Net.Runtime;
|
||||
using Moq;
|
||||
using Xunit.Extensions;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc.Razor.Test
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,11 +5,22 @@
|
|||
"Microsoft.AspNet.Razor": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.Mvc.Razor" : "",
|
||||
"Microsoft.AspNet.Mvc.Razor.Host" : "",
|
||||
"Moq": "4.0.10827",
|
||||
"Xunit": "1.9.1",
|
||||
"Xunit.extensions": "1.9.1"
|
||||
"TestCommon" : "",
|
||||
"Xunit.KRunner": "0.1-alpha-*",
|
||||
"xunit.abstractions": "2.0.0-aspnet-*",
|
||||
"xunit.assert": "2.0.0-aspnet-*",
|
||||
"xunit.core": "2.0.0-aspnet-*",
|
||||
"xunit.execution": "2.0.0-aspnet-*"
|
||||
},
|
||||
"commands": {
|
||||
"test": "Xunit.KRunner"
|
||||
},
|
||||
"configurations": {
|
||||
"net45": { }
|
||||
"net45": {
|
||||
"dependencies": {
|
||||
"Moq": "4.2.1312.1622",
|
||||
"System.Reflection": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,11 +5,21 @@
|
|||
"Microsoft.AspNet.PipelineCore": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.Mvc.Rendering" : "",
|
||||
"TestCommon" : "",
|
||||
"Moq": "4.0.10827",
|
||||
"Xunit": "1.9.1",
|
||||
"Xunit.extensions": "1.9.1"
|
||||
"Xunit.KRunner": "0.1-alpha-*",
|
||||
"xunit.abstractions": "2.0.0-aspnet-*",
|
||||
"xunit.assert": "2.0.0-aspnet-*",
|
||||
"xunit.core": "2.0.0-aspnet-*",
|
||||
"xunit.execution": "2.0.0-aspnet-*"
|
||||
},
|
||||
"commands": {
|
||||
"test": "Xunit.KRunner"
|
||||
},
|
||||
"configurations": {
|
||||
"net45": { }
|
||||
"net45": {
|
||||
"dependencies": {
|
||||
"Moq": "4.2.1312.1622",
|
||||
"System.Reflection": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using Xunit.Sdk;
|
||||
|
||||
namespace Microsoft.AspNet.Mvc
|
||||
{
|
||||
|
|
@ -9,7 +10,7 @@ namespace Microsoft.AspNet.Mvc
|
|||
/// Replaces the current culture and UI culture for the test.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class ReplaceCultureAttribute : Xunit.BeforeAfterTestAttribute
|
||||
internal class ReplaceCultureAttribute : BeforeAfterTestAttribute
|
||||
{
|
||||
private const string _defaultCultureName = "en-GB";
|
||||
private const string _defaultUICultureName = "en-US";
|
||||
|
|
|
|||
|
|
@ -1,10 +1,17 @@
|
|||
{
|
||||
"shared": "*.cs",
|
||||
"dependencies": {
|
||||
"Xunit": "1.9.1",
|
||||
"Xunit.extensions": "1.9.1"
|
||||
"xunit.abstractions": "2.0.0-aspnet-*",
|
||||
"xunit.assert": "2.0.0-aspnet-*",
|
||||
"xunit.core": "2.0.0-aspnet-*",
|
||||
"xunit.execution": "2.0.0-aspnet-*"
|
||||
},
|
||||
"configurations": {
|
||||
"net45": { }
|
||||
"net45": {
|
||||
"dependencies": {
|
||||
"Moq": "4.2.1312.1622",
|
||||
"System.Reflection": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue