Skip to content

Commit

Permalink
removed nullness overrides (#1123)
Browse files Browse the repository at this point in the history
  • Loading branch information
majastrz committed Dec 11, 2020
1 parent 835fc7a commit 3b92e37
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void PrintProgram_AnyProgram_ShouldProduceExpectedOutput(DataSet dataSet)
var formattedOutput = PrettyPrinter.PrintProgram(program, options);
formattedOutput.Should().NotBeNull();

var resultsFile = FileHelper.SaveResultFile(this.TestContext!, Path.Combine(dataSet.Name, DataSet.TestFileMainFormatted), formattedOutput!);
var resultsFile = FileHelper.SaveResultFile(this.TestContext, Path.Combine(dataSet.Name, DataSet.TestFileMainFormatted), formattedOutput!);

formattedOutput.Should().EqualWithLineByLineDiffOutput(
TestContext,
Expand Down
6 changes: 3 additions & 3 deletions src/Bicep.LangServer.IntegrationTests/CompletionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ public class CompletionTests
public async Task EmptyFileShouldProduceDeclarationCompletions()
{
const string expectedSetName = "declarations";
var uri = DocumentUri.From($"/{this.TestContext!.TestName}");
var uri = DocumentUri.From($"/{this.TestContext.TestName}");

using var client = await IntegrationTestHelper.StartServerWithTextAsync(string.Empty, uri);

var actual = await GetActualCompletions(client, uri, new Position(0, 0));
var actualLocation = FileHelper.SaveResultFile(this.TestContext!, $"{this.TestContext.TestName}_{expectedSetName}", actual.ToString(Formatting.Indented));
var actualLocation = FileHelper.SaveResultFile(this.TestContext, $"{this.TestContext.TestName}_{expectedSetName}", actual.ToString(Formatting.Indented));

var expectedStr = DataSets.Completions.TryGetValue(GetFullSetName(expectedSetName));
if (expectedStr == null)
Expand Down Expand Up @@ -116,7 +116,7 @@ private void ValidateCompletions(DataSet dataSet, string setName, List<(Position
}

var actual = JToken.Parse(single.Key);
var actualLocation = FileHelper.SaveResultFile(this.TestContext!, $"{dataSet.Name}_{setName}_Actual.json", actual.ToString(Formatting.Indented));
var actualLocation = FileHelper.SaveResultFile(this.TestContext, $"{dataSet.Name}_{setName}_Actual.json", actual.ToString(Formatting.Indented));

var expected = expectedInfo.Value.content;
var expectedLocation = expectedInfo.Value.scope switch
Expand Down
16 changes: 9 additions & 7 deletions src/Bicep.LangServer.UnitTests/BicepCompilationManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Bicep.Core.FileSystem;
using Bicep.Core.Syntax;
Expand All @@ -25,6 +26,7 @@ public class BicepCompilationManagerTests
{
private static readonly MockRepository Repository = new MockRepository(MockBehavior.Strict);

[NotNull]
public TestContext? TestContext { get; set; }

private static IFileResolver CreateEmptyFileResolver()
Expand All @@ -42,7 +44,7 @@ public void UpsertCompilation_ShouldUpsertSuccessfully()
var manager = new BicepCompilationManager(server.Object, new BicepCompilationProvider(TestResourceTypeProvider.Create(), CreateEmptyFileResolver()), new Workspace());

const int version = 42;
var uri = DocumentUri.File(this.TestContext!.TestName);
var uri = DocumentUri.File(this.TestContext.TestName);

// first get should not return anything
manager.GetCompilation(uri).Should().BeNull();
Expand Down Expand Up @@ -86,7 +88,7 @@ public void CloseAfterUpsert_ShouldClearDiagnostics()
var manager = new BicepCompilationManager(server.Object, new BicepCompilationProvider(TestResourceTypeProvider.Create(), CreateEmptyFileResolver()), new Workspace());

const int version = 42;
var uri = DocumentUri.File(this.TestContext!.TestName);
var uri = DocumentUri.File(this.TestContext.TestName);

// first get should not return anything
manager.GetCompilation(uri).Should().BeNull();
Expand Down Expand Up @@ -153,7 +155,7 @@ public void UpsertCompilation_ShouldUpdateDiagnostics()
var manager = new BicepCompilationManager(server.Object, new BicepCompilationProvider(TestResourceTypeProvider.Create(), CreateEmptyFileResolver()), new Workspace());

const int version = 42;
var uri = DocumentUri.File(this.TestContext!.TestName);
var uri = DocumentUri.File(this.TestContext.TestName);

// first get should not return anything
manager.GetCompilation(uri).Should().BeNull();
Expand Down Expand Up @@ -215,7 +217,7 @@ public void GetNonExistentCompilation_ShouldNotThrow()

var manager = new BicepCompilationManager(server.Object, new BicepCompilationProvider(TestResourceTypeProvider.Create(), CreateEmptyFileResolver()), new Workspace());

var uri = DocumentUri.File(this.TestContext!.TestName);
var uri = DocumentUri.File(this.TestContext.TestName);

manager.GetCompilation(uri).Should().BeNull();
}
Expand All @@ -231,7 +233,7 @@ public void CloseNonExistentCompilation_ShouldClearDiagnostics()

var manager = new BicepCompilationManager(server.Object, new BicepCompilationProvider(TestResourceTypeProvider.Create(), CreateEmptyFileResolver()), new Workspace());

var uri = DocumentUri.File(this.TestContext!.TestName);
var uri = DocumentUri.File(this.TestContext.TestName);

manager.CloseCompilation(uri);

Expand Down Expand Up @@ -264,7 +266,7 @@ public void FatalException_ShouldProduceCorrectDiagnosticsAndClearThemWhenFileIs
var manager = new BicepCompilationManager(server.Object, provider.Object, new Workspace());

const int version = 74;
var uri = DocumentUri.File(this.TestContext!.TestName);
var uri = DocumentUri.File(this.TestContext.TestName);

// upsert should fail because of the mock fatal exception
manager.UpsertCompilation(uri, version, "fake");
Expand Down Expand Up @@ -312,7 +314,7 @@ public void NormalUpsertAfterFatalException_ShouldReplaceDiagnostics()
const string expectedMessage = "Internal bicep exception.";

const int version = 74;
var uri = DocumentUri.File(this.TestContext!.TestName);
var uri = DocumentUri.File(this.TestContext.TestName);

// start by failing
bool failUpsert = true;
Expand Down

0 comments on commit 3b92e37

Please sign in to comment.