Modifying tests to run in both in aspnet50 and aspnetcore50
* Additionally trimming references from project.json
This commit is contained in:
parent
99fe8294e9
commit
473f642dde
|
|
@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Razor.Runtime
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cannot resolve TagHelper containing assembly '{0}'. Error: '{1}'.
|
||||
/// Cannot resolve TagHelper containing assembly '{0}'.
|
||||
/// </summary>
|
||||
internal static string TagHelperTypeResolver_CannotResolveTagHelperAssembly
|
||||
{
|
||||
|
|
@ -39,11 +39,11 @@ namespace Microsoft.AspNet.Razor.Runtime
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cannot resolve TagHelper containing assembly '{0}'. Error: '{1}'.
|
||||
/// Cannot resolve TagHelper containing assembly '{0}'.
|
||||
/// </summary>
|
||||
internal static string FormatTagHelperTypeResolver_CannotResolveTagHelperAssembly(object p0, object p1)
|
||||
internal static string FormatTagHelperTypeResolver_CannotResolveTagHelperAssembly(object p0)
|
||||
{
|
||||
return string.Format(CultureInfo.CurrentCulture, GetString("TagHelperTypeResolver_CannotResolveTagHelperAssembly"), p0, p1);
|
||||
return string.Format(CultureInfo.CurrentCulture, GetString("TagHelperTypeResolver_CannotResolveTagHelperAssembly"), p0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@
|
|||
"typeName, assemblyName"</value>
|
||||
</data>
|
||||
<data name="TagHelperTypeResolver_CannotResolveTagHelperAssembly" xml:space="preserve">
|
||||
<value>Cannot resolve TagHelper containing assembly '{0}'. Error: '{1}'.</value>
|
||||
<value>Cannot resolve TagHelper containing assembly '{0}'.</value>
|
||||
</data>
|
||||
<data name="TagHelperTypeResolver_TagHelperAssemblyNameCannotBeEmptyOrNull" xml:space="preserve">
|
||||
<value>Tag helper directive assembly name cannot be null or empty.</value>
|
||||
|
|
|
|||
|
|
@ -57,8 +57,7 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
catch (Exception ex)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
Resources.FormatTagHelperTypeResolver_CannotResolveTagHelperAssembly(assemblyName.Name,
|
||||
ex.Message));
|
||||
Resources.FormatTagHelperTypeResolver_CannotResolveTagHelperAssembly(assemblyName.Name), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
},
|
||||
"frameworks": {
|
||||
"net45": { },
|
||||
"aspnet50": { },
|
||||
"aspnetcore50": {
|
||||
"dependencies": {
|
||||
"System.Reflection.Extensions": "4.0.0-beta-*"
|
||||
|
|
|
|||
|
|
@ -427,13 +427,13 @@ namespace Microsoft.AspNet.Razor.Editor
|
|||
else
|
||||
{
|
||||
RazorEditorTrace.TraceLine(RazorResources.FormatTrace_NoChangesArrived(fileNameOnly));
|
||||
#if NET45
|
||||
#if ASPNETCORE50
|
||||
// This does the equivalent of thread.yield under the covers.
|
||||
spinWait.SpinOnce();
|
||||
#else
|
||||
// No Yield in CoreCLR
|
||||
|
||||
Thread.Yield();
|
||||
#else
|
||||
// This does the equivalent of thread.yield under the covers.
|
||||
spinWait.SpinOnce();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,20 +2,17 @@
|
|||
"version": "4.0.0-*",
|
||||
"frameworks": {
|
||||
"net45": { },
|
||||
"aspnet50": { },
|
||||
"aspnetcore50": {
|
||||
"dependencies": {
|
||||
"System.Collections": "4.0.10-beta-*",
|
||||
"System.Diagnostics.Debug": "4.0.10-beta-*",
|
||||
"System.Diagnostics.Tools": "4.0.0-beta-*",
|
||||
"System.Globalization": "4.0.10-beta-*",
|
||||
"System.IO": "4.0.10-beta-*",
|
||||
"System.IO.FileSystem": "4.0.0-beta-*",
|
||||
"System.Linq": "4.0.0-beta-*",
|
||||
"System.Reflection": "4.0.10-beta-*",
|
||||
"System.Resources.ResourceManager": "4.0.0-beta-*",
|
||||
"System.Runtime": "4.0.20-beta-*",
|
||||
"System.Runtime.Extensions": "4.0.10-beta-*",
|
||||
"System.Runtime.InteropServices": "4.0.20-beta-*",
|
||||
"System.Threading": "4.0.0-beta-*",
|
||||
"System.Threading.Tasks": "4.0.10-beta-*",
|
||||
"System.Threading.Thread": "4.0.0-beta-*",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Reflection;
|
||||
using Microsoft.AspNet.Razor.TagHelpers;
|
||||
using Xunit;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -40,10 +41,8 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
var tagHelperTypeResolver = new TagHelperTypeResolver();
|
||||
var expectedErrorMessage = string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"Cannot resolve TagHelper containing assembly '{0}'. Error: '{1}'.",
|
||||
"abcd",
|
||||
"Could not load file or assembly 'abcd' or one of its dependencies. " +
|
||||
"The system cannot find the file specified.");
|
||||
"Cannot resolve TagHelper containing assembly '{0}'.",
|
||||
"abcd");
|
||||
|
||||
// Act & Assert
|
||||
var ex = Assert.Throws<InvalidOperationException>(() =>
|
||||
|
|
@ -51,7 +50,12 @@ namespace Microsoft.AspNet.Razor.Runtime.TagHelpers
|
|||
tagHelperTypeResolver.Resolve("abcd");
|
||||
});
|
||||
|
||||
Assert.Equal(expectedErrorMessage, ex.Message, StringComparer.OrdinalIgnoreCase);
|
||||
Assert.Equal(expectedErrorMessage, ex.Message);
|
||||
#if ASPNETCORE50
|
||||
Assert.IsType<FileLoadException>(ex.InnerException);
|
||||
#else
|
||||
Assert.IsType<FileNotFoundException>(ex.InnerException);
|
||||
#endif
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -2,12 +2,18 @@
|
|||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Razor.Runtime": "4.0.0-*",
|
||||
"Microsoft.AspNet.Razor.Test": "1.0.0"
|
||||
"Microsoft.AspNet.Testing": "1.0.0-*",
|
||||
"Xunit.KRunner": "1.0.0-*"
|
||||
},
|
||||
"commands": {
|
||||
"test": "Xunit.KRunner"
|
||||
},
|
||||
"frameworks": {
|
||||
"aspnet50": { }
|
||||
"aspnet50": { },
|
||||
"aspnetcore50": {
|
||||
"dependencies": {
|
||||
"System.Runtime.Extensions": "4.0.10-beta-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ using Microsoft.AspNet.Razor.Test.Framework;
|
|||
using Microsoft.AspNet.Razor.Test.Utils;
|
||||
using Microsoft.AspNet.Razor.Text;
|
||||
using Microsoft.AspNet.Testing;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Test.Editor
|
||||
|
|
@ -176,11 +175,6 @@ namespace Microsoft.AspNet.Razor.Test.Editor
|
|||
return new TextChange(0, 0, new StringTextBuffer(String.Empty), 3, new StringTextBuffer("foo"));
|
||||
}
|
||||
|
||||
private static Mock<RazorEditorParser> CreateMockParser()
|
||||
{
|
||||
return new Mock<RazorEditorParser>(CreateHost(), TestLinePragmaFileName) { CallBase = true };
|
||||
}
|
||||
|
||||
private static RazorEditorParser CreateClientParser()
|
||||
{
|
||||
return new RazorEditorParser(CreateHost(), TestLinePragmaFileName);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ using System.Collections.Generic;
|
|||
using System.Reflection;
|
||||
using Microsoft.AspNet.Razor.Generator.Compiler;
|
||||
using Microsoft.AspNet.Razor.TagHelpers;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Test.Generator
|
||||
|
|
@ -46,9 +45,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
|
|||
public void TagHelpers_WithinHelpersAndSections_GeneratesExpectedOutput(string testType)
|
||||
{
|
||||
// Arrange
|
||||
var propertyInfoMock = new Mock<PropertyInfo>();
|
||||
propertyInfoMock.Setup(propertyInfo => propertyInfo.PropertyType).Returns(typeof(string));
|
||||
propertyInfoMock.Setup(propertyInfo => propertyInfo.Name).Returns("BoundProperty");
|
||||
var propertyInfo = typeof(TestType).GetProperty("BoundProperty");
|
||||
var tagHelperDescriptors = new TagHelperDescriptor[]
|
||||
{
|
||||
new TagHelperDescriptor("MyTagHelper",
|
||||
|
|
@ -56,7 +53,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
|
|||
ContentBehavior.None,
|
||||
new [] {
|
||||
new TagHelperAttributeDescriptor("BoundProperty",
|
||||
propertyInfoMock.Object)
|
||||
propertyInfo)
|
||||
}),
|
||||
new TagHelperDescriptor("NestedTagHelper", "NestedTagHelper", ContentBehavior.Modify)
|
||||
};
|
||||
|
|
@ -72,35 +69,29 @@ namespace Microsoft.AspNet.Razor.Test.Generator
|
|||
public void TagHelpers_GenerateExpectedOutput(string testType)
|
||||
{
|
||||
// Arrange
|
||||
var pFooPropertyInfo = new Mock<PropertyInfo>();
|
||||
pFooPropertyInfo.Setup(propertyInfo => propertyInfo.PropertyType).Returns(typeof(int));
|
||||
pFooPropertyInfo.Setup(propertyInfo => propertyInfo.Name).Returns("Foo");
|
||||
var inputTypePropertyInfo = new Mock<PropertyInfo>();
|
||||
inputTypePropertyInfo.Setup(propertyInfo => propertyInfo.PropertyType).Returns(typeof(string));
|
||||
inputTypePropertyInfo.Setup(propertyInfo => propertyInfo.Name).Returns("Type");
|
||||
var checkedPropertyInfo = new Mock<PropertyInfo>();
|
||||
checkedPropertyInfo.Setup(propertyInfo => propertyInfo.PropertyType).Returns(typeof(bool));
|
||||
checkedPropertyInfo.Setup(propertyInfo => propertyInfo.Name).Returns("Checked");
|
||||
var pFooPropertyInfo = typeof(TestType).GetProperty("Foo");
|
||||
var inputTypePropertyInfo = typeof(TestType).GetProperty("Type");
|
||||
var checkedPropertyInfo = typeof(TestType).GetProperty("Checked");
|
||||
var tagHelperDescriptors = new TagHelperDescriptor[]
|
||||
{
|
||||
new TagHelperDescriptor("p",
|
||||
"PTagHelper",
|
||||
ContentBehavior.None,
|
||||
new [] {
|
||||
new TagHelperAttributeDescriptor("foo", pFooPropertyInfo.Object)
|
||||
new TagHelperAttributeDescriptor("foo", pFooPropertyInfo)
|
||||
}),
|
||||
new TagHelperDescriptor("input",
|
||||
"InputTagHelper",
|
||||
ContentBehavior.None,
|
||||
new TagHelperAttributeDescriptor[] {
|
||||
new TagHelperAttributeDescriptor("type", inputTypePropertyInfo.Object)
|
||||
new TagHelperAttributeDescriptor("type", inputTypePropertyInfo)
|
||||
}),
|
||||
new TagHelperDescriptor("input",
|
||||
"InputTagHelper2",
|
||||
ContentBehavior.None,
|
||||
new TagHelperAttributeDescriptor[] {
|
||||
new TagHelperAttributeDescriptor("type", inputTypePropertyInfo.Object),
|
||||
new TagHelperAttributeDescriptor("checked", checkedPropertyInfo.Object)
|
||||
new TagHelperAttributeDescriptor("type", inputTypePropertyInfo),
|
||||
new TagHelperAttributeDescriptor("checked", checkedPropertyInfo)
|
||||
})
|
||||
};
|
||||
|
||||
|
|
@ -124,5 +115,16 @@ namespace Microsoft.AspNet.Razor.Test.Generator
|
|||
// Act & Assert
|
||||
RunTagHelperTest("ContentBehaviorTagHelpers", tagHelperDescriptors: tagHelperDescriptors);
|
||||
}
|
||||
|
||||
private class TestType
|
||||
{
|
||||
public int Foo { get; set; }
|
||||
|
||||
public string Type { get; set; }
|
||||
|
||||
public bool Checked { get; set; }
|
||||
|
||||
public string BoundProperty { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
#if !ASPNETCORE50
|
||||
using Microsoft.AspNet.Razor.Generator;
|
||||
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
|
||||
using Microsoft.AspNet.Razor.Test.Utils;
|
||||
|
|
@ -41,3 +42,4 @@ namespace Microsoft.AspNet.Razor.Test.Generator.CodeTree
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,4 +1,8 @@
|
|||
using Microsoft.AspNet.Razor.Generator;
|
||||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
#if !ASPNETCORE50
|
||||
using Microsoft.AspNet.Razor.Generator;
|
||||
using Microsoft.AspNet.Razor.Generator.Compiler;
|
||||
using Moq;
|
||||
using Moq.Protected;
|
||||
|
|
@ -40,3 +44,4 @@ namespace Microsoft.AspNet.Razor
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -7,7 +7,6 @@ using Microsoft.AspNet.Razor.Generator;
|
|||
using Microsoft.AspNet.Razor.Generator.Compiler;
|
||||
using Microsoft.AspNet.Razor.Generator.Compiler.CSharp;
|
||||
using Microsoft.AspNet.Razor.TagHelpers;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Test.Generator
|
||||
|
|
@ -18,12 +17,8 @@ namespace Microsoft.AspNet.Razor.Test.Generator
|
|||
public void TagHelpers_CanReplaceAttributeCodeGeneratorLogic()
|
||||
{
|
||||
// Arrange
|
||||
var inputTypePropertyInfo = new Mock<PropertyInfo>();
|
||||
inputTypePropertyInfo.Setup(propertyInfo => propertyInfo.PropertyType).Returns(typeof(string));
|
||||
inputTypePropertyInfo.Setup(propertyInfo => propertyInfo.Name).Returns("Type");
|
||||
var checkedPropertyInfo = new Mock<PropertyInfo>();
|
||||
checkedPropertyInfo.Setup(propertyInfo => propertyInfo.PropertyType).Returns(typeof(bool));
|
||||
checkedPropertyInfo.Setup(propertyInfo => propertyInfo.Name).Returns("Checked");
|
||||
var inputTypePropertyInfo = typeof(TestType).GetProperty("Type");
|
||||
var checkedPropertyInfo = typeof(TestType).GetProperty("Checked");
|
||||
var tagHelperDescriptors = new TagHelperDescriptor[]
|
||||
{
|
||||
new TagHelperDescriptor("p", "PTagHelper", ContentBehavior.None),
|
||||
|
|
@ -31,14 +26,14 @@ namespace Microsoft.AspNet.Razor.Test.Generator
|
|||
"InputTagHelper",
|
||||
ContentBehavior.None,
|
||||
new TagHelperAttributeDescriptor[] {
|
||||
new TagHelperAttributeDescriptor("type", inputTypePropertyInfo.Object)
|
||||
new TagHelperAttributeDescriptor("type", inputTypePropertyInfo)
|
||||
}),
|
||||
new TagHelperDescriptor("input",
|
||||
"InputTagHelper2",
|
||||
ContentBehavior.None,
|
||||
new TagHelperAttributeDescriptor[] {
|
||||
new TagHelperAttributeDescriptor("type", inputTypePropertyInfo.Object),
|
||||
new TagHelperAttributeDescriptor("checked", checkedPropertyInfo.Object)
|
||||
new TagHelperAttributeDescriptor("type", inputTypePropertyInfo),
|
||||
new TagHelperAttributeDescriptor("checked", checkedPropertyInfo)
|
||||
})
|
||||
};
|
||||
|
||||
|
|
@ -96,5 +91,12 @@ namespace Microsoft.AspNet.Razor.Test.Generator
|
|||
base.RenderAttributeValue(attributeInfo, writer, context, renderAttributeValue);
|
||||
}
|
||||
}
|
||||
|
||||
private class TestType
|
||||
{
|
||||
public string Type { get; set; }
|
||||
|
||||
public bool Checked { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,9 @@ using Microsoft.AspNet.Razor.Parser;
|
|||
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
|
||||
using Microsoft.AspNet.Razor.Test.Framework;
|
||||
using Microsoft.AspNet.Razor.Text;
|
||||
#if !ASPNETCORE50
|
||||
using Moq;
|
||||
#endif
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Test.Parser
|
||||
|
|
@ -69,6 +71,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser
|
|||
RunOnEndBlockTest(endBlockCallback => new CallbackVisitor(_ => { }, _ => { }, _ => { }, endBlockCallback));
|
||||
}
|
||||
|
||||
#if !ASPNETCORE50
|
||||
[Fact]
|
||||
public void ListenerCallsOnEndSpanCallbackUsingSynchronizationContextIfSpecified()
|
||||
{
|
||||
|
|
@ -120,6 +123,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser
|
|||
Assert.Equal(expected, actual);
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
private static void RunOnStartBlockTest(Func<Action<BlockType>, CallbackVisitor> ctor, Action<BlockType, BlockType> verifyResults = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree;
|
|||
using Microsoft.AspNet.Razor.Test.Framework;
|
||||
using Microsoft.AspNet.Razor.Text;
|
||||
using Microsoft.AspNet.Razor.Tokenizer.Symbols;
|
||||
#if !ASPNETCORE50
|
||||
using Moq;
|
||||
#endif
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Test.Parser
|
||||
|
|
@ -137,6 +139,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser
|
|||
Assert.Equal(BlockType.Expression, context.BlockStack.Peek().Type);
|
||||
}
|
||||
|
||||
#if !ASPNETCORE50
|
||||
[Fact]
|
||||
public void EndBlockAddsCurrentBlockToParentBlock()
|
||||
{
|
||||
|
|
@ -185,6 +188,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser
|
|||
// Assert
|
||||
ParserTestBase.EvaluateResults(context.CompleteParse(), expected.Build());
|
||||
}
|
||||
#endif
|
||||
|
||||
[Fact]
|
||||
public void SwitchActiveParserSetsMarkupParserAsActiveIfCodeParserCurrentlyActive()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
#if !ASPNETCORE50
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNet.Razor.Parser;
|
||||
|
|
@ -83,3 +84,4 @@ namespace Microsoft.AspNet.Razor.Test.Parser
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -9,8 +9,10 @@ using Microsoft.AspNet.Razor.Parser;
|
|||
using Microsoft.AspNet.Razor.Parser.SyntaxTree;
|
||||
using Microsoft.AspNet.Razor.TagHelpers;
|
||||
using Microsoft.AspNet.Razor.Test.Framework;
|
||||
#if !ASPNETCORE50
|
||||
using Moq;
|
||||
using Moq.Protected;
|
||||
#endif
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Test.Parser
|
||||
|
|
@ -64,6 +66,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser
|
|||
factory.Markup(" baz")));
|
||||
}
|
||||
|
||||
#if !ASPNETCORE50
|
||||
[Fact]
|
||||
public void GetTagHelperDescriptors_IsInvokedToLocateTagHelperDescriptors()
|
||||
{
|
||||
|
|
@ -84,6 +87,7 @@ namespace Microsoft.AspNet.Razor.Test.Parser
|
|||
// Assert
|
||||
parser.Verify();
|
||||
}
|
||||
#endif
|
||||
|
||||
[Fact]
|
||||
public void ParseMethodSetsUpRunWithSpecifiedCodeParserMarkupParserAndListenerAndPassesToMarkupParser()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Test
|
||||
|
|
@ -21,8 +21,9 @@ namespace Microsoft.AspNet.Razor.Test
|
|||
public void EnsureRazorDirectiveProperties()
|
||||
{
|
||||
// Arrange
|
||||
var attribute = (AttributeUsageAttribute)typeof(RazorDirectiveAttribute).GetCustomAttributes(typeof(AttributeUsageAttribute), inherit: false)
|
||||
.SingleOrDefault();
|
||||
var attribute = typeof(RazorDirectiveAttribute)
|
||||
.GetTypeInfo()
|
||||
.GetCustomAttribute<AttributeUsageAttribute>(inherit: false);
|
||||
|
||||
// Assert
|
||||
Assert.True(attribute.AllowMultiple);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
#if !ASPNETCORE50
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
|
@ -330,3 +331,4 @@ namespace Microsoft.AspNet.Razor.Test
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -155,11 +155,13 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
|||
RunDisposeTest(r => r.Dispose());
|
||||
}
|
||||
|
||||
#if !ASPNETCORE50
|
||||
[Fact]
|
||||
public void CloseDisposesSourceReader()
|
||||
{
|
||||
RunDisposeTest(r => r.Close());
|
||||
}
|
||||
#endif
|
||||
|
||||
[Fact]
|
||||
public void ReadWithBufferSupportsLookahead()
|
||||
|
|
|
|||
|
|
@ -142,11 +142,13 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
|||
RunDisposeTest(r => r.Dispose());
|
||||
}
|
||||
|
||||
#if !ASPNETCORE50
|
||||
[Fact]
|
||||
public void CloseDisposesSourceReader()
|
||||
{
|
||||
RunDisposeTest(r => r.Close());
|
||||
}
|
||||
#endif
|
||||
|
||||
[Fact]
|
||||
public void ReadWithBufferSupportsLookahead()
|
||||
|
|
|
|||
|
|
@ -4,13 +4,16 @@
|
|||
using System;
|
||||
using System.Web.WebPages.TestUtils;
|
||||
using Microsoft.AspNet.Razor.Text;
|
||||
#if !ASPNETCORE50
|
||||
using Moq;
|
||||
#endif
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.Razor.Test.Text
|
||||
{
|
||||
public class TextChangeTest
|
||||
{
|
||||
#if !ASPNETCORE50
|
||||
[Fact]
|
||||
public void ConstructorRequiresNonNegativeOldPosition()
|
||||
{
|
||||
|
|
@ -158,6 +161,7 @@ namespace Microsoft.AspNet.Razor.Test.Text
|
|||
Assert.Equal(1, change.NewText.Length);
|
||||
Assert.Equal(5, change.OldText.Length);
|
||||
}
|
||||
#endif
|
||||
|
||||
[Fact]
|
||||
public void OldTextReturnsOldSpanFromOldBuffer()
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace Microsoft.AspNet.Razor.Test
|
|||
|
||||
public static TestFile Create(string localResourceName)
|
||||
{
|
||||
return new TestFile(localResourceName, Assembly.GetCallingAssembly());
|
||||
return new TestFile(localResourceName, typeof(TestFile).GetTypeInfo().Assembly);
|
||||
}
|
||||
|
||||
public Stream OpenRead()
|
||||
|
|
|
|||
|
|
@ -11,6 +11,11 @@
|
|||
"test": "Xunit.KRunner"
|
||||
},
|
||||
"frameworks": {
|
||||
"aspnet50": { }
|
||||
"aspnet50": { },
|
||||
"aspnetcore50": {
|
||||
"dependencies": {
|
||||
"System.Diagnostics.TraceSource": "4.0.0-beta-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue