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
Original file line number Diff line number Diff line change
Expand Up @@ -534,14 +534,13 @@ public static void Main(string[] args)
.Which
.Diagnostics
.Should()
.BeEquivalentTo(new[]
{
.ContainEquivalentOf(
new Diagnostic(
new LinePositionSpan(new LinePosition(0, 10), new LinePosition(0, 28)),
CodeAnalysis.DiagnosticSeverity.Error,
"CS0029",
"(1,11): error CS0029: Cannot implicitly convert type 'string' to 'int'")
});
);
}

[Fact]
Expand Down Expand Up @@ -575,7 +574,7 @@ public static void Main(string[] args)
.Which
.Diagnostics
.Should()
.BeEmpty();
.NotContain(d => d.Severity == CodeAnalysis.DiagnosticSeverity.Error);
}

[Fact]
Expand Down Expand Up @@ -606,14 +605,60 @@ public static void Main(string[] args)
.Which
.Diagnostics
.Should()
.BeEquivalentTo(new[]
{
.ContainEquivalentOf(
new Diagnostic(
new LinePositionSpan(new LinePosition(0, 10), new LinePosition(0, 15)),
CodeAnalysis.DiagnosticSeverity.Error,
"CS0029",
"(1,11): error CS0029: Cannot implicitly convert type 'string' to 'int'")
});
);
}

[Fact]
public async Task project_files_are_case_insensitive()
{
var kernel = new CSharpProjectKernel("csharp");

// the console project defaults to a file named `Program.cs` so by specifying `program.cs` we're
// effectively adding a duplicate file
await kernel.SendAsync(new OpenProject(new Project(new[] { new ProjectFile("program.cs", @"using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Text.RegularExpressions;

namespace Program
{
class Program
{
static void Main(string[] args)
{
#region controller

#endregion
}
}
}") })));
await kernel.SendAsync(new OpenDocument("./program.cs", regionName: "controller"));
await kernel.SendAsync(new SubmitCode("var a = 123;"));
var kernelResult = await kernel.SendAsync(new CompileProject());
var kernelEvents = kernelResult.KernelEvents.ToSubscribedList();

using var _ = new AssertionScope();

kernelEvents
.Should()
.NotContainErrors();

kernelEvents
.Should()
.ContainSingle<AssemblyProduced>()
.Which
.Assembly
.Value
.Should()
.NotBeNullOrWhiteSpace();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// 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 System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis.Text;
Expand All @@ -20,7 +21,7 @@ public Workspace Extract(IReadOnlyCollection<ProjectFileContent> sourceFiles, st

private static (ProjectFileContent[], Buffer[]) ProcessSourceFiles(IEnumerable<ProjectFileContent> sourceFiles)
{
var files = new Dictionary<string, ProjectFileContent>();
var files = new Dictionary<string, ProjectFileContent>(StringComparer.OrdinalIgnoreCase);
var newBuffers = new List<Buffer>();
foreach (var sourceFile in sourceFiles)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public async Task<Workspace> TransformAsync(Workspace source)
}

return f.ToSourceFile();
});
}, StringComparer.OrdinalIgnoreCase);

var buffers = new List<Buffer>();
foreach (var sourceBuffer in source.Buffers)
Expand Down
Loading