diff --git a/test/Microsoft.AspNet.Razor.Runtime.Precompilation.Test/project.json b/test/Microsoft.AspNet.Razor.Runtime.Precompilation.Test/project.json index a14207d70a..23f3145c73 100644 --- a/test/Microsoft.AspNet.Razor.Runtime.Precompilation.Test/project.json +++ b/test/Microsoft.AspNet.Razor.Runtime.Precompilation.Test/project.json @@ -1,40 +1,38 @@ { - "version": "1.0.0", - "compilationOptions": { - "warningsAsErrors": true, - "keyFile": "../../tools/Key.snk" + "version": "1.0.0", + "compilationOptions": { + "warningsAsErrors": true, + "keyFile": "../../tools/Key.snk" + }, + "dependencies": { + "Microsoft.AspNet.Razor.Runtime.Precompilation.Files": "1.0.0-*", + "Microsoft.AspNet.Razor.Runtime.Test": "1.0.0-*", + "Microsoft.AspNet.Razor.Test.Sources": { + "version": "4.0.0-*", + "type": "build" }, - "dependencies": { - "Microsoft.AspNet.Razor.Runtime.Precompilation.Files": "1.0.0-*", - "Microsoft.AspNet.Razor.Runtime.Test": "1.0.0-*", - "Microsoft.AspNet.Razor.Test.Sources": { - "version": "4.0.0-*", - "type": "build" - }, - "Microsoft.Dnx.Compilation.CSharp.Common": "1.0.0-*", - "Microsoft.Extensions.HashCodeCombiner.Sources": { - "type": "build", - "version": "1.0.0-*" - } - }, - "resource": [ - "../Microsoft.AspNet.Razor.Runtime.Precompilation.Files/*.cs", - "../Microsoft.AspNet.Razor.Runtime.Test/Runtime/TagHelpers/TestTagHelpers/*.cs", - "BadFiles/*.cs" - ], - "commands": { - "test": "xunit.runner.aspnet" - }, - "frameworks": { - "dnx451": { - "frameworkAssemblies": { - "System.Text.Encoding": "" - }, - "dependencies": { - "Moq": "4.2.1312.1622" - } - }, - "dnxcore50": { - } + "Microsoft.Dnx.Compilation.CSharp.Common": "1.0.0-*", + "Microsoft.Extensions.HashCodeCombiner.Sources": { + "type": "build", + "version": "1.0.0-*" } + }, + "resource": [ + "../Microsoft.AspNet.Razor.Runtime.Precompilation.Files/*.cs", + "../Microsoft.AspNet.Razor.Runtime.Test/Runtime/TagHelpers/TestTagHelpers/*.cs", + "BadFiles/*.cs" + ], + "commands": { + "test": "xunit.runner.aspnet" + }, + "frameworks": { + "dnx451": { + "frameworkAssemblies": { + "System.Text.Encoding": "" + } + + }, + "dnxcore50": { + } + } } diff --git a/test/Microsoft.AspNet.Razor.Test/Chunks/Generators/ChunkVisitorTests.cs b/test/Microsoft.AspNet.Razor.Test/Chunks/Generators/ChunkVisitorTests.cs index 0ccb0214c0..32df8eca28 100644 --- a/test/Microsoft.AspNet.Razor.Test/Chunks/Generators/ChunkVisitorTests.cs +++ b/test/Microsoft.AspNet.Razor.Test/Chunks/Generators/ChunkVisitorTests.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if !DNXCORE50 using Microsoft.AspNet.Razor.CodeGenerators; using Microsoft.AspNet.Razor.CodeGenerators.Visitors; using Moq; @@ -45,4 +44,3 @@ namespace Microsoft.AspNet.Razor.Chunks.Generators } } } -#endif diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpCodeGeneratorTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpCodeGeneratorTest.cs index 436a18acf5..95713d289f 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpCodeGeneratorTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpCodeGeneratorTest.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if !DNXCORE50 #if GENERATE_BASELINES using System; #endif @@ -66,4 +65,4 @@ namespace Microsoft.AspNet.Razor.CodeGenerators } } } -#endif + diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/CallbackParserListenerTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/CallbackParserListenerTest.cs index 132a294c7f..86073f0851 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/CallbackParserListenerTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/CallbackParserListenerTest.cs @@ -6,9 +6,7 @@ using System.Threading; using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; -#if !DNXCORE50 using Moq; -#endif using Xunit; namespace Microsoft.AspNet.Razor.Test.Parser @@ -70,7 +68,6 @@ namespace Microsoft.AspNet.Razor.Test.Parser RunOnEndBlockTest(endBlockCallback => new CallbackVisitor(_ => { }, _ => { }, _ => { }, endBlockCallback)); } -#if !DNXCORE50 [Fact] public void ListenerCallsOnEndSpanCallbackUsingSynchronizationContextIfSpecified() { @@ -123,7 +120,6 @@ namespace Microsoft.AspNet.Razor.Test.Parser Assert.Equal(expected, actual); }); } -#endif private static void RunOnStartBlockTest(Func, CallbackVisitor> ctor, Action verifyResults = null) { diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/ParserContextTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/ParserContextTest.cs index 20ccbf5c14..9d915ae9bd 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/ParserContextTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/ParserContextTest.cs @@ -8,9 +8,7 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.AspNet.Razor.Text; using Microsoft.AspNet.Razor.Tokenizer.Symbols; -#if !DNXCORE50 using Moq; -#endif using Xunit; namespace Microsoft.AspNet.Razor.Test.Parser @@ -125,7 +123,6 @@ namespace Microsoft.AspNet.Razor.Test.Parser Assert.Equal(BlockType.Expression, context.BlockStack.Peek().Type); } -#if !DNXCORE50 [Fact] public void EndBlockAddsCurrentBlockToParentBlock() { @@ -174,7 +171,6 @@ namespace Microsoft.AspNet.Razor.Test.Parser // Assert ParserTestBase.EvaluateResults(context.CompleteParse(), expected.Build()); } -#endif [Fact] public void SwitchActiveParserSetsMarkupParserAsActiveIfCodeParserCurrentlyActive() diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/ParserVisitorExtensionsTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/ParserVisitorExtensionsTest.cs index 72a0e85687..d1f14a9a42 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/ParserVisitorExtensionsTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/ParserVisitorExtensionsTest.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if !DNXCORE50 using System.Collections.Generic; using System.Linq; using Microsoft.AspNet.Razor.Parser; @@ -77,4 +76,3 @@ namespace Microsoft.AspNet.Razor.Test.Parser } } } -#endif diff --git a/test/Microsoft.AspNet.Razor.Test/Parser/RazorParserTest.cs b/test/Microsoft.AspNet.Razor.Test/Parser/RazorParserTest.cs index f45d2b173d..4164bf1689 100644 --- a/test/Microsoft.AspNet.Razor.Test/Parser/RazorParserTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Parser/RazorParserTest.cs @@ -9,10 +9,8 @@ using Microsoft.AspNet.Razor.Parser; using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Compilation.TagHelpers; using Microsoft.AspNet.Razor.Test.Framework; -#if !DNXCORE50 using Moq; using Moq.Protected; -#endif using Xunit; namespace Microsoft.AspNet.Razor.Test.Parser @@ -66,7 +64,6 @@ namespace Microsoft.AspNet.Razor.Test.Parser factory.Markup(" baz"))); } -#if !DNXCORE50 [Fact] public void GetTagHelperDescriptors_IsInvokedToLocateTagHelperDescriptors() { @@ -89,7 +86,6 @@ namespace Microsoft.AspNet.Razor.Test.Parser // Assert parser.Verify(); } -#endif [Fact] public void ParseMethodSetsUpRunWithSpecifiedCodeParserMarkupParserAndListenerAndPassesToMarkupParser() diff --git a/test/Microsoft.AspNet.Razor.Test/RazorTemplateEngineTest.cs b/test/Microsoft.AspNet.Razor.Test/RazorTemplateEngineTest.cs index 60f3b9caa3..419c637434 100644 --- a/test/Microsoft.AspNet.Razor.Test/RazorTemplateEngineTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/RazorTemplateEngineTest.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if !DNXCORE50 using System.Collections.Generic; using System.IO; using System.Text; @@ -117,8 +116,9 @@ namespace Microsoft.AspNet.Razor.Test var expected = new CSharpCodeGenerator(codeGeneratorContext); - mockHost.Setup(h => h.DecorateCodeGenerator(It.IsAny(), codeGeneratorContext)) - .Returns(expected); + mockHost + .Setup(h => h.DecorateCodeGenerator(It.IsAny(), codeGeneratorContext)) + .Returns(expected); var engine = new RazorTemplateEngine(mockHost.Object); // Act @@ -140,9 +140,10 @@ namespace Microsoft.AspNet.Razor.Test mockEngine.Object.ParseTemplate(reader, cancelToken: source.Token); // Assert - mockEngine.Verify(e => e.ParseTemplateCore(It.Is(l => l.ReadToEnd() == "foo"), - null, - source.Token)); + mockEngine.Verify(e => e.ParseTemplateCore( + It.Is(l => l.ReadToEnd() == "foo"), + null, + source.Token)); } [Fact] @@ -157,11 +158,21 @@ namespace Microsoft.AspNet.Razor.Test var src = "Baz"; // Act - mockEngine.Object.GenerateCode(reader, className: className, rootNamespace: ns, sourceFileName: src, cancelToken: source.Token); + mockEngine.Object.GenerateCode( + reader, + className: className, + rootNamespace: ns, + sourceFileName: src, + cancelToken: source.Token); // Assert - mockEngine.Verify(e => e.GenerateCodeCore(It.Is(l => l.ReadToEnd() == "foo"), - className, ns, src, null, source.Token)); + mockEngine.Verify(e => e.GenerateCodeCore( + It.Is(l => l.ReadToEnd() == "foo"), + className, + ns, + src, + null, + source.Token)); } [Fact] @@ -202,7 +213,11 @@ namespace Microsoft.AspNet.Razor.Test var engine = new RazorTemplateEngine(CreateHost(designTime: true)); // Act - var results = engine.GenerateCode(new StringTextBuffer("foo @bar()"), className: null, rootNamespace: null, sourceFileName: "foo.cshtml"); + var results = engine.GenerateCode( + new StringTextBuffer("foo @bar()"), + className: null, + rootNamespace: null, + sourceFileName: "foo.cshtml"); // Assert Assert.True(results.Success); @@ -311,12 +326,13 @@ namespace Microsoft.AspNet.Razor.Test public string Checksum { get; set; } - protected internal override GeneratorResults GenerateCodeCore(ITextDocument input, - string className, - string rootNamespace, - string sourceFileName, - string checksum, - CancellationToken? cancelToken) + protected internal override GeneratorResults GenerateCodeCore( + ITextDocument input, + string className, + string rootNamespace, + string sourceFileName, + string checksum, + CancellationToken? cancelToken) { Checksum = checksum; return null; @@ -324,4 +340,3 @@ namespace Microsoft.AspNet.Razor.Test } } } -#endif diff --git a/test/Microsoft.AspNet.Razor.Test/TagHelpers/TagHelperDirectiveSpanVisitorTest.cs b/test/Microsoft.AspNet.Razor.Test/TagHelpers/TagHelperDirectiveSpanVisitorTest.cs index a1db3f7921..b60a3e4ed7 100644 --- a/test/Microsoft.AspNet.Razor.Test/TagHelpers/TagHelperDirectiveSpanVisitorTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/TagHelpers/TagHelperDirectiveSpanVisitorTest.cs @@ -9,9 +9,7 @@ using Microsoft.AspNet.Razor.Parser.SyntaxTree; using Microsoft.AspNet.Razor.Parser.TagHelpers; using Microsoft.AspNet.Razor.Test.Framework; using Microsoft.Extensions.Internal; -#if !DNXCORE50 using Moq; -#endif using Xunit; namespace Microsoft.AspNet.Razor.Compilation.TagHelpers @@ -20,7 +18,6 @@ namespace Microsoft.AspNet.Razor.Compilation.TagHelpers { private static readonly SpanFactory Factory = SpanFactory.CreateCsHtml(); -#if !DNXCORE50 [Fact] public void GetDescriptors_InvokesResolveOnceForAllDirectives() { @@ -43,7 +40,6 @@ namespace Microsoft.AspNet.Razor.Compilation.TagHelpers // Assert resolver.Verify(mock => mock.Resolve(It.IsAny()), Times.Once); } -#endif [Fact] public void GetDescriptors_LocatesTagHelperChunkGenerator_CreatesDirectiveDescriptors() diff --git a/test/Microsoft.AspNet.Razor.Test/Text/TextChangeTest.cs b/test/Microsoft.AspNet.Razor.Test/Text/TextChangeTest.cs index c7679f8861..11172bcbd5 100644 --- a/test/Microsoft.AspNet.Razor.Test/Text/TextChangeTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/Text/TextChangeTest.cs @@ -4,16 +4,13 @@ using System; using System.Web.WebPages.TestUtils; using Microsoft.AspNet.Razor.Text; -#if !DNXCORE50 using Moq; -#endif using Xunit; namespace Microsoft.AspNet.Razor.Test.Text { public class TextChangeTest { -#if !DNXCORE50 [Fact] public void ConstructorRequiresNonNegativeOldPosition() { @@ -149,7 +146,6 @@ namespace Microsoft.AspNet.Razor.Test.Text Assert.Equal(1, change.NewText.Length); Assert.Equal(5, change.OldText.Length); } -#endif [Fact] public void OldTextReturnsOldSpanFromOldBuffer() diff --git a/test/Microsoft.AspNet.Razor.Test/project.json b/test/Microsoft.AspNet.Razor.Test/project.json index 4ab77fce59..7861a912da 100644 --- a/test/Microsoft.AspNet.Razor.Test/project.json +++ b/test/Microsoft.AspNet.Razor.Test/project.json @@ -21,6 +21,7 @@ }, "dnxcore50": { "dependencies": { + "moq.netcore": "4.4.0-beta8", "System.Diagnostics.TraceSource": "4.0.0-*", "System.Reflection.TypeExtensions": "4.0.1-*", "System.Runtime.Serialization.Primitives": "4.0.11-*"