这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions DotNetTry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Interactiv
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Microsoft.DotNet.Interactive.FSharp", "Microsoft.DotNet.Interactive.FSharp\Microsoft.DotNet.Interactive.FSharp.fsproj", "{12821999-9F44-486B-8EE3-38F0EFDFDA32}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MLS.Agent.Tools.Tests", "MLS.Agent.Tools.Tests\MLS.Agent.Tools.Tests.csproj", "{0F8F3C1A-F1D3-4476-9E5B-219BBAC8DBC6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -191,6 +193,10 @@ Global
{90A9DF5F-CBEE-4B6B-8B58-BA94B0BDCF3C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90A9DF5F-CBEE-4B6B-8B58-BA94B0BDCF3C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90A9DF5F-CBEE-4B6B-8B58-BA94B0BDCF3C}.Release|Any CPU.Build.0 = Release|Any CPU
{11752CED-0F22-433D-B0B4-BA642C1BA613}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{11752CED-0F22-433D-B0B4-BA642C1BA613}.Debug|Any CPU.Build.0 = Debug|Any CPU
{11752CED-0F22-433D-B0B4-BA642C1BA613}.Release|Any CPU.ActiveCfg = Release|Any CPU
{11752CED-0F22-433D-B0B4-BA642C1BA613}.Release|Any CPU.Build.0 = Release|Any CPU
{12821999-9F44-486B-8EE3-38F0EFDFDA32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12821999-9F44-486B-8EE3-38F0EFDFDA32}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12821999-9F44-486B-8EE3-38F0EFDFDA32}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -199,6 +205,10 @@ Global
{11752CED-0F22-433D-B0B4-BA642C1BA613}.Debug|Any CPU.Build.0 = Debug|Any CPU
{11752CED-0F22-433D-B0B4-BA642C1BA613}.Release|Any CPU.ActiveCfg = Release|Any CPU
{11752CED-0F22-433D-B0B4-BA642C1BA613}.Release|Any CPU.Build.0 = Release|Any CPU
{0F8F3C1A-F1D3-4476-9E5B-219BBAC8DBC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0F8F3C1A-F1D3-4476-9E5B-219BBAC8DBC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0F8F3C1A-F1D3-4476-9E5B-219BBAC8DBC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0F8F3C1A-F1D3-4476-9E5B-219BBAC8DBC6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -233,8 +243,10 @@ Global
{113A4166-5734-4F6E-B609-D6CF42679399} = {6EE8F484-DFA2-4F0F-939F-400CE78DFAC2}
{2BB7CCD7-73D1-4B16-82EC-A5D0183F8CF5} = {6EE8F484-DFA2-4F0F-939F-400CE78DFAC2}
{90A9DF5F-CBEE-4B6B-8B58-BA94B0BDCF3C} = {6EE8F484-DFA2-4F0F-939F-400CE78DFAC2}
{11752CED-0F22-433D-B0B4-BA642C1BA613} = {8192FEAD-BCE6-4E62-97E5-2E9EA884BD71}
{12821999-9F44-486B-8EE3-38F0EFDFDA32} = {6EE8F484-DFA2-4F0F-939F-400CE78DFAC2}
{11752CED-0F22-433D-B0B4-BA642C1BA613} = {8192FEAD-BCE6-4E62-97E5-2E9EA884BD71}
{0F8F3C1A-F1D3-4476-9E5B-219BBAC8DBC6} = {8192FEAD-BCE6-4E62-97E5-2E9EA884BD71}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D6CD99BA-B16B-4570-8910-225CBDFFA3AD}
Expand Down
1 change: 1 addition & 0 deletions MLS.Agent.Tests/AgentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.DependencyInjection;
using MLS.Agent.CommandLine;
using MLS.Agent.Tools;
using Pocket;
using Recipes;
using WorkspaceServer;
Expand Down
3 changes: 2 additions & 1 deletion MLS.Agent.Tests/ApiViaHttpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
using System.Web;
using MLS.Agent.Controllers;
using WorkspaceServer.Tests.Packaging;
using WorkspaceServer.Tests.TestUtility;
using CodeManipulation = WorkspaceServer.Tests.CodeManipulation;
using SourceFile = Microsoft.DotNet.Try.Protocol.ClientApi.SourceFile;
using WorkspaceServer;
using MLS.Agent.Tools;
using MLS.Agent.Tools.Tests;

namespace MLS.Agent.Tests
{
Expand Down
4 changes: 2 additions & 2 deletions MLS.Agent.Tests/CommandLine/CommandLineParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
using Microsoft.Extensions.DependencyInjection;
using MLS.Agent.CommandLine;
using WorkspaceServer;
using WorkspaceServer.Tests.TestUtility;
using Xunit;
using Xunit.Abstractions;
using MLS.Agent.Tools;
using WorkspaceServer.Tests;

namespace MLS.Agent.Tests.CommandLine
Expand Down Expand Up @@ -96,7 +96,7 @@ public async Task Parse_production_mode_flag_switches_option_to_production()
[Fact]
public async Task Parse_root_directory_with_a_valid_path_succeeds()
{
var path = TestAssets.SampleConsole.FullName;
var path = Directory.GetCurrentDirectory();
await _parser.InvokeAsync(new[] { path }, _console);
_startOptions.RootDirectory.GetFullyQualifiedRoot().FullName.Should().Be(path + Path.DirectorySeparatorChar);
}
Expand Down
1 change: 1 addition & 0 deletions MLS.Agent.Tests/CommandLine/StartupOptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using MLS.Agent.CommandLine;
using MLS.Agent.Tools;
using WorkspaceServer;
using Xunit;

Expand Down
2 changes: 2 additions & 0 deletions MLS.Agent.Tests/CommandLine/VerifyCommandTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using Microsoft.DotNet.Try.Markdown;
using Microsoft.DotNet.Try.Protocol.Tests;
using MLS.Agent.CommandLine;
using MLS.Agent.Tools;
using MLS.Agent.Tools.Tests;
using WorkspaceServer;
using WorkspaceServer.Tests;
using Xunit;
Expand Down
3 changes: 2 additions & 1 deletion MLS.Agent.Tests/DocumentationAPITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
using HtmlAgilityPack;
using Microsoft.DotNet.Try.Markdown;
using MLS.Agent.CommandLine;
using MLS.Agent.Tools;
using MLS.Agent.Tools.Tests;
using Recipes;
using WorkspaceServer;
using WorkspaceServer.Tests;
using WorkspaceServer.Tests.TestUtility;
using Xunit;

namespace MLS.Agent.Tests
Expand Down
11 changes: 4 additions & 7 deletions MLS.Agent.Tests/Markdown/CodeBlockAnnotationExtensionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
using MLS.Agent.Controllers;
using MLS.Agent.Markdown;
using MLS.Agent.Tools;
using MLS.Agent.Tools.Tests;
using WorkspaceServer;
using WorkspaceServer.Packaging;
using WorkspaceServer.Tests;
using WorkspaceServer.Tests.TestUtility;
using Xunit;

namespace MLS.Agent.Tests.Markdown
Expand Down Expand Up @@ -45,7 +45,6 @@ public CodeBlockAnnotationExtensionTests()
[InlineData("C#")]
public async Task Inserts_code_when_an_existing_file_is_specified_using_source_file_option(string language)
{
var testDir = TestAssets.SampleConsole;
var fileContent = @"using System;

namespace BasicConsoleApp
Expand All @@ -58,7 +57,7 @@ static void MyProgram(string[] args)
}
}
}".EnforceLF();
var directoryAccessor = new InMemoryDirectoryAccessor(testDir)
var directoryAccessor = new InMemoryDirectoryAccessor()
{
("Program.cs", fileContent),
("sample.csproj", "")
Expand Down Expand Up @@ -104,8 +103,7 @@ public async Task Does_not_insert_code_when_supported_language_is_specified_but_
</code></pre>
".EnforceLF();

var testDir = TestAssets.SampleConsole;
var directoryAccessor = new InMemoryDirectoryAccessor(testDir);
var directoryAccessor = new InMemoryDirectoryAccessor();
var pipeline = new MarkdownPipelineBuilder().UseCodeBlockAnnotations(directoryAccessor,await Default.PackageRegistry.ValueAsync()).Build();
var document = $@"
```{fenceLanguage}
Expand All @@ -119,8 +117,7 @@ public async Task Does_not_insert_code_when_supported_language_is_specified_but_
[Fact]
public async Task Error_message_is_displayed_when_the_linked_file_does_not_exist()
{
var testDir = TestAssets.SampleConsole;
var directoryAccessor = new InMemoryDirectoryAccessor(testDir)
var directoryAccessor = new InMemoryDirectoryAccessor()
{
("sample.csproj", "")
};
Expand Down
6 changes: 3 additions & 3 deletions MLS.Agent.Tests/Markdown/MarkdownFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
using MLS.Agent.CommandLine;
using MLS.Agent.Markdown;
using WorkspaceServer.Tests;
using WorkspaceServer.Tests.TestUtility;
using Xunit;
using Xunit.Abstractions;
using MLS.Agent.Tools;
using MLS.Agent.Tools.Tests;

namespace MLS.Agent.Tests.Markdown
{
Expand Down Expand Up @@ -123,10 +124,9 @@ static void MyProgram(string[] args)
[Fact]
public async Task Should_parse_markdown_file_and_set_package_with_fully_resolved_path()
{
var workingDir = TestAssets.SampleConsole;
var packagePathRelativeToBaseDir = "src/sample/sample.csproj";

var dirAccessor = new InMemoryDirectoryAccessor(workingDir)
var dirAccessor = new InMemoryDirectoryAccessor()
{
("src/sample/Program.cs", ""),
(packagePathRelativeToBaseDir, ""),
Expand Down
6 changes: 3 additions & 3 deletions MLS.Agent.Tests/Markdown/MarkdownProjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
using Microsoft.DotNet.Try.Markdown;
using MLS.Agent.Markdown;
using WorkspaceServer.Tests;
using WorkspaceServer.Tests.TestUtility;
using MLS.Agent.Tools;
using MLS.Agent.Tools.Tests;

namespace MLS.Agent.Tests
{
Expand All @@ -21,8 +22,7 @@ public class GetAllMarkdownFiles
[Fact]
public async Task Returns_list_of_all_relative_paths_to_all_markdown_files()
{
var workingDir = TestAssets.SampleConsole;
var dirAccessor = new InMemoryDirectoryAccessor(workingDir)
var dirAccessor = new InMemoryDirectoryAccessor()
{
("Readme.md", ""),
("Subdirectory/Tutorial.md", ""),
Expand Down
1 change: 1 addition & 0 deletions MLS.Agent.Tests/WorkspaceDiscoveryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Buffer = Microsoft.DotNet.Try.Protocol.Buffer;
using File = Microsoft.DotNet.Try.Protocol.File;
using WorkspaceServer;
using MLS.Agent.Tools;

namespace MLS.Agent.Tests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
using System.Runtime.CompilerServices;
using FluentAssertions;
using Microsoft.DotNet.PlatformAbstractions;
using Microsoft.DotNet.Try.Markdown;
using WorkspaceServer;
using WorkspaceServer.Packaging;
using WorkspaceServer.Tests;
using WorkspaceServer.Tests.Packaging;
using WorkspaceServer.Tests.TestUtility;
using MLS.Agent.Tools;
using MLS.Agent.Tools.Tests;
using Xunit;
using static Microsoft.DotNet.PlatformAbstractions.RuntimeEnvironment;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.DotNet.Try.Markdown;

namespace WorkspaceServer.Tests
namespace MLS.Agent.Tools.Tests
{
public class InMemoryDirectoryAccessor : IDirectoryAccessor, IEnumerable
{
Expand Down
31 changes: 31 additions & 0 deletions MLS.Agent.Tools.Tests/MLS.Agent.Tools.Tests.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<AssetTargetFallback>portable-net45+win8+wp8+wpa81</AssetTargetFallback>
<NoWarn>$(NoWarn);8002</NoWarn><!-- Assent isn't strongly signed -->
</PropertyGroup>

<ItemGroup>
<Compile Remove="TestResults\**" />
<Compile Remove="TestProjects\**" />
<EmbeddedResource Remove="TestResults\**" />
<None Remove="TestResults\**" />
</ItemGroup>

<ItemGroup>
<None Include="TestProjects\**">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.8.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MLS.Agent.Tools\MLS.Agent.Tools.csproj" />
<ProjectReference Include="..\WorkspaceServer\WorkspaceServer.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
using System.Reactive.Concurrency;
using System.Threading.Tasks;
using Clockwise;
using MLS.Agent.Tools;
using WorkspaceServer.Packaging;

namespace WorkspaceServer.Tests.Packaging
namespace MLS.Agent.Tools.Tests
{
public static class PackageUtilities
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

using System;
using FluentAssertions;
using MLS.Agent.Tools;
using Xunit;

namespace Microsoft.DotNet.Try.Markdown.Tests
namespace MLS.Agent.Tools.Tests
{
public class RelativeDirectoryPathTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

using System;
using FluentAssertions;
using MLS.Agent.Tools;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.DotNet.Try.Markdown.Tests
namespace MLS.Agent.Tools.Tests
{
public class RelativeFilePathTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System.IO;

namespace WorkspaceServer.Tests.TestUtility
namespace MLS.Agent.Tools.Tests
{
public static class TestAssets
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using MLS.Agent.Tools.Roslyn;
using System.IO;
using Microsoft.DotNet.Try.Markdown;
using WorkspaceServer.Servers.Roslyn;

namespace WorkspaceServer
namespace MLS.Agent.Tools
{
public static class DirectoryAccessor
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// adpated from http://source.roslyn.io/#Microsoft.CodeAnalysis/InternalUtilities/FileNameUtilities.cs,c5e9631691356ed7

namespace WorkspaceServer.Servers.Roslyn
namespace MLS.Agent.Tools
{
/// <summary>
/// Implements a few file name utilities that are needed by the compiler.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using MLS.Agent.Tools.Roslyn;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.DotNet.Try.Markdown;
using WorkspaceServer.Packaging;
using WorkspaceServer.Servers.Roslyn;

namespace WorkspaceServer
namespace MLS.Agent.Tools
{
public class FileSystemDirectoryAccessor : IDirectoryAccessor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

using System.Collections.Generic;
using System.IO;
using Microsoft.DotNet.Try.Markdown;

namespace WorkspaceServer
namespace MLS.Agent.Tools
{
public interface IDirectoryAccessor
{
Expand Down
1 change: 0 additions & 1 deletion MLS.Agent.Tools/MLS.Agent.Tools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@
<ItemGroup>
<Folder Include="%28External%29\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

// adapted from http://source.roslyn.io/#System.Reflection.Metadata/System/Reflection/Internal/Utilities/PathUtilities.cs,36b27d7696df4d1e

namespace WorkspaceServer.Servers.Roslyn
namespace MLS.Agent.Tools.Roslyn
{
// Contains path parsing utilities.
// We need our own because System.IO.Path is insufficient for our purposes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System;

namespace Microsoft.DotNet.Try.Markdown
namespace MLS.Agent.Tools
{
public class RelativeDirectoryPath :
RelativePath,
Expand Down
Loading