Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Commit

Permalink
Merge pull request #7 from justaprogrammer/fixes-again
Browse files Browse the repository at this point in the history
Fixes again
  • Loading branch information
StanleyGoldman authored Nov 2, 2018
2 parents 33b9949 + 2c68f82 commit 44b93e7
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 64 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ before_build:
- ps: gitversion /output buildserver
build_script:
- ps: >-
fake run Build.fsx -p 3
fake run Build.fsx
test: off
56 changes: 45 additions & 11 deletions src/BCC.MSBuildLog.Tests/Services/BinaryLogProcessorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ public void Should_TestConsoleApp1_Warning()
13,
13,
CheckWarningLevel.Warning,
"CS0219: The variable 'hello' is assigned but its value is never used")
"The variable 'hello' is assigned but its value is never used")
{
Title = "CS0219: TestConsoleApp1/Program.cs(13)"
}
);
}

Expand Down Expand Up @@ -76,7 +79,10 @@ public void Should_TestConsoleApp1_Warning_ConfigureAs_Warning_For_Other_Code()
13,
13,
CheckWarningLevel.Warning,
"CS0219: The variable 'hello' is assigned but its value is never used")
"The variable 'hello' is assigned but its value is never used")
{
Title = "CS0219: TestConsoleApp1/Program.cs(13)"
}
);
}

Expand Down Expand Up @@ -106,7 +112,10 @@ public void Should_TestConsoleApp1_Warning_ConfigureAs_Warning()
13,
13,
CheckWarningLevel.Warning,
"CS0219: The variable 'hello' is assigned but its value is never used")
"The variable 'hello' is assigned but its value is never used")
{
Title = "CS0219: TestConsoleApp1/Program.cs(13)"
}
);
}

Expand Down Expand Up @@ -136,7 +145,10 @@ public void Should_TestConsoleApp1_Warning_ConfigureAs_Notice()
13,
13,
CheckWarningLevel.Notice,
"CS0219: The variable 'hello' is assigned but its value is never used")
"The variable 'hello' is assigned but its value is never used")
{
Title = "CS0219: TestConsoleApp1/Program.cs(13)"
}
);
}

Expand Down Expand Up @@ -166,7 +178,10 @@ public void Should_TestConsoleApp1_Warning_ConfigureAs_Error()
13,
13,
CheckWarningLevel.Failure,
"CS0219: The variable 'hello' is assigned but its value is never used")
"The variable 'hello' is assigned but its value is never used")
{
Title = "CS0219: TestConsoleApp1/Program.cs(13)"
}
);
}

Expand Down Expand Up @@ -205,7 +220,10 @@ public void Should_TestConsoleApp1_Error()
13,
13,
CheckWarningLevel.Failure,
"CS1002: ; expected")
"; expected")
{
Title = "CS1002: TestConsoleApp1/Program.cs(13)"
}
);
}

Expand All @@ -224,7 +242,10 @@ public void Should_TestConsoleApp1_CodeAnalysis()
20,
20,
CheckWarningLevel.Warning,
"CA2213: Microsoft.Usage : 'Program.MyClass' contains field 'Program.MyClass._inner' that is of IDisposable type: 'Program.MyOTherClass'. Change the Dispose method on 'Program.MyClass' to call Dispose or Close on this field.")
"Microsoft.Usage : 'Program.MyClass' contains field 'Program.MyClass._inner' that is of IDisposable type: 'Program.MyOTherClass'. Change the Dispose method on 'Program.MyClass' to call Dispose or Close on this field.")
{
Title = "CA2213: TestConsoleApp1/Program.cs(20)"
}
);
}

Expand All @@ -245,15 +266,21 @@ public void Should_MSBLOC()
56,
56,
CheckWarningLevel.Warning,
"CS0219: The variable 'filename' is assigned but its value is never used"));
"The variable 'filename' is assigned but its value is never used")
{
Title = "CS0219: MSBLOC.Core.Tests/Services/BinaryLogProcessorTests.cs(56)"
});

logData.Annotations[1].Should().BeEquivalentTo(
new Annotation(
"MSBLOC.Core.Tests/Services/BinaryLogProcessorTests.cs",
83,
83,
CheckWarningLevel.Warning,
"CS0219: The variable 'filename' is assigned but its value is never used"));
"The variable 'filename' is assigned but its value is never used")
{
Title = "CS0219: MSBLOC.Core.Tests/Services/BinaryLogProcessorTests.cs(83)"
});
}

[Fact]
Expand All @@ -273,16 +300,23 @@ public void Should_Parse_OctokitGraphQL()
43,
43,
CheckWarningLevel.Warning,
"CS1591: Missing XML comment for publicly visible type or member 'Connection.Uri'"));
"Missing XML comment for publicly visible type or member 'Connection.Uri'")
{
Title = "CS1591: Octokit.GraphQL.Core/Connection.cs(43)"
});

logData.Annotations[1].Should().BeEquivalentTo(
new Annotation(
"Octokit.GraphQL.Core/Connection.cs",
44,
44,
CheckWarningLevel.Warning,
"CS1591: Missing XML comment for publicly visible type or member 'Connection.CredentialStore'"));
"Missing XML comment for publicly visible type or member 'Connection.CredentialStore'")
{
Title = "CS1591: Octokit.GraphQL.Core/Connection.cs(44)"
});
}

[Fact]
public void Should_Parse_GitHubVisualStudio()
{
Expand Down
54 changes: 34 additions & 20 deletions src/BCC.MSBuildLog.Tests/Services/BuildLogProcessorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void Should_Create_Empty_CheckRun()

checkRun.Conclusion.Should().Be(CheckConclusion.Success);
checkRun.Name.Should().Be("MSBuild Log");
checkRun.Title.Should().Be("0 Errors 0 Warnings");
checkRun.Title.Should().Be("0 errors - 0 warnings");
checkRun.Summary.Should().Be(string.Empty);
checkRun.Annotations.Should().AllBeEquivalentTo(annotations);
}
Expand Down Expand Up @@ -93,7 +93,7 @@ public void Should_Create_Empty_CheckRun_With_Configuration()

checkRun.Conclusion.Should().Be(CheckConclusion.Success);
checkRun.Name.Should().Be("MSBuild Log");
checkRun.Title.Should().Be("0 Errors 0 Warnings");
checkRun.Title.Should().Be("0 errors - 0 warnings");
checkRun.Summary.Should().Be(string.Empty);
checkRun.Annotations.Should().AllBeEquivalentTo(annotations);
}
Expand All @@ -111,11 +111,11 @@ public void Should_Create_CheckRun_With_Warning()
Faker.Lorem.Word())
};

var checkRun = GetCheckRun(CreateMockBinaryLogProcessor(annotations));
var checkRun = GetCheckRun(CreateMockBinaryLogProcessor(annotations, 1));

checkRun.Conclusion.Should().Be(CheckConclusion.Success);
checkRun.Name.Should().Be("MSBuild Log");
checkRun.Title.Should().Be("0 Errors 0 Warnings");
checkRun.Title.Should().Be("0 errors - 1 warning");
checkRun.Summary.Should().Be(string.Empty);
checkRun.Annotations.Should().BeEquivalentTo<Annotation>(annotations);
}
Expand Down Expand Up @@ -150,7 +150,7 @@ public void Should_Create_CheckRun_With_Configuration()
var mockFileSystem = new MockFileSystem();
mockFileSystem.AddFile(configurationFile, new MockFileData(JsonConvert.SerializeObject(expectedCheckRunConfiguration)));

var mockBinaryLogProcessor = CreateMockBinaryLogProcessor(annotations);
var mockBinaryLogProcessor = CreateMockBinaryLogProcessor(annotations, 1);
var checkRun = GetCheckRun(mockBinaryLogProcessor, configurationFile: configurationFile, mockFileSystem: mockFileSystem);

mockBinaryLogProcessor.Received(1).ProcessLog(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<CheckRunConfiguration>());
Expand All @@ -159,7 +159,7 @@ public void Should_Create_CheckRun_With_Configuration()

checkRun.Conclusion.Should().Be(CheckConclusion.Success);
checkRun.Name.Should().Be(expectedCheckRunConfiguration.Name);
checkRun.Title.Should().Be("0 Errors 0 Warnings");
checkRun.Title.Should().Be("0 errors - 1 warning");
checkRun.Summary.Should().Be(string.Empty);
checkRun.Annotations.Should().BeEquivalentTo<Annotation>(annotations);
}
Expand All @@ -176,11 +176,11 @@ public void Should_Create_CheckRun_With_Failure()
CheckWarningLevel.Failure, Faker.Lorem.Word())
};

var checkRun = GetCheckRun(CreateMockBinaryLogProcessor(annotations));
var checkRun = GetCheckRun(CreateMockBinaryLogProcessor(annotations, 0, 1));

checkRun.Conclusion.Should().Be(CheckConclusion.Failure);
checkRun.Name.Should().Be("MSBuild Log");
checkRun.Title.Should().Be("0 Errors 0 Warnings");
checkRun.Title.Should().Be("1 error - 0 warnings");
checkRun.Summary.Should().Be(string.Empty);
checkRun.Annotations.Should().BeEquivalentTo<Annotation>(annotations);
}
Expand All @@ -194,19 +194,21 @@ public void Should_Create_CheckRun_With_WarningAndFailure()
Faker.System.FilePath(),
Faker.Random.Int(),
Faker.Random.Int(),
CheckWarningLevel.Warning, Faker.Lorem.Word()),
CheckWarningLevel.Warning,
Faker.Lorem.Word()),
new Annotation(
Faker.System.FilePath(),
Faker.Random.Int(),
Faker.Random.Int(),
CheckWarningLevel.Failure, Faker.Lorem.Word())
CheckWarningLevel.Failure,
Faker.Lorem.Word())
};

var checkRun = GetCheckRun(CreateMockBinaryLogProcessor(annotations));
var checkRun = GetCheckRun(CreateMockBinaryLogProcessor(annotations, 1, 1));

checkRun.Conclusion.Should().Be(CheckConclusion.Failure);
checkRun.Name.Should().Be("MSBuild Log");
checkRun.Title.Should().Be("0 Errors 0 Warnings");
checkRun.Title.Should().Be("1 error - 1 warning");
checkRun.Summary.Should().Be(string.Empty);
checkRun.Annotations.Should().BeEquivalentTo<Annotation>(annotations);
}
Expand All @@ -218,9 +220,13 @@ public void Should_Create_CheckRun_TestConsoleApp1_Warning()
{
new Annotation(
"TestConsoleApp1/Program.cs",
13,
13,
CheckWarningLevel.Warning, "CS0219: The variable 'hello' is assigned but its value is never used")
13,
CheckWarningLevel.Warning,
"The variable 'hello' is assigned but its value is never used")
{
Title = "CS0219: TestConsoleApp1/Program.cs(13)"
}
};

var cloneRoot = @"C:\projects\testconsoleapp1\";
Expand All @@ -230,7 +236,7 @@ public void Should_Create_CheckRun_TestConsoleApp1_Warning()

checkRun.Conclusion.Should().Be(CheckConclusion.Success);
checkRun.Name.Should().Be("MSBuild Log");
checkRun.Title.Should().Be("0 Errors 1 Warning");
checkRun.Title.Should().Be("0 errors - 1 warning");
checkRun.Summary.Should().Be(string.Empty);
checkRun.Annotations.Should().BeEquivalentTo<Annotation>(annotations);
}
Expand All @@ -242,9 +248,13 @@ public void Should_Create_CheckRun_TestConsoleApp1_Error()
{
new Annotation(
"TestConsoleApp1/Program.cs",
13,
13,
CheckWarningLevel.Failure, "CS1002: ; expected")
13,
CheckWarningLevel.Failure,
"; expected")
{
Title = "CS1002: TestConsoleApp1/Program.cs(13)"
}
};

var cloneRoot = @"C:\projects\testconsoleapp1\";
Expand All @@ -254,7 +264,7 @@ public void Should_Create_CheckRun_TestConsoleApp1_Error()

checkRun.Conclusion.Should().Be(CheckConclusion.Failure);
checkRun.Name.Should().Be("MSBuild Log");
checkRun.Title.Should().Be("1 Error 0 Warnings");
checkRun.Title.Should().Be("1 error - 0 warnings");
checkRun.Summary.Should().Be(string.Empty);
checkRun.Annotations.Should().BeEquivalentTo<Annotation>(annotations);
}
Expand All @@ -268,7 +278,11 @@ public void Should_Create_CheckRun_TestConsoleApp1_CodeAnalysis()
"TestConsoleApp1/Program.cs",
20,
20,
CheckWarningLevel.Warning, "CA2213: Microsoft.Usage : 'Program.MyClass' contains field 'Program.MyClass._inner' that is of IDisposable type: 'Program.MyOTherClass'. Change the Dispose method on 'Program.MyClass' to call Dispose or Close on this field.")
CheckWarningLevel.Warning,
"Microsoft.Usage : 'Program.MyClass' contains field 'Program.MyClass._inner' that is of IDisposable type: 'Program.MyOTherClass'. Change the Dispose method on 'Program.MyClass' to call Dispose or Close on this field.")
{
Title = "CA2213: TestConsoleApp1/Program.cs(20)"
}
};

var cloneRoot = @"C:\projects\testconsoleapp1\";
Expand All @@ -278,7 +292,7 @@ public void Should_Create_CheckRun_TestConsoleApp1_CodeAnalysis()

checkRun.Conclusion.Should().Be(CheckConclusion.Success);
checkRun.Name.Should().Be("MSBuild Log");
checkRun.Title.Should().Be("0 Errors 1 Warning");
checkRun.Title.Should().Be("0 errors - 1 warning");
checkRun.Summary.Should().Be(string.Empty);
checkRun.Annotations.Should().BeEquivalentTo<Annotation>(annotations);
}
Expand Down
6 changes: 3 additions & 3 deletions src/BCC.MSBuildLog.Tests/Services/CommandLineParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void ShouldRequireRequiredArguments()
{
"-i", $@"""{inputPath}""",
"-o", $@"""{outputPath}""",
"-c", $@"""{cloneRoot}"""
"-r", $@"""{cloneRoot}"""
});

listener.DidNotReceive().Callback(Arg.Any<string>());
Expand Down Expand Up @@ -98,8 +98,8 @@ public void ShouldBeAbleToSetConfigurationArgument()
{
"-i", $@"""{inputPath}""",
"-o", $@"""{outputPath}""",
"-c", $@"""{cloneRoot}""",
"--configuration", $@"""{configurationFile}"""
"-r", $@"""{cloneRoot}""",
"-c", $@"""{configurationFile}"""
});

listener.DidNotReceive().Callback(Arg.Any<string>());
Expand Down
3 changes: 2 additions & 1 deletion src/BCC.MSBuildLog/BCC.MSBuildLog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.1;net471</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<StartupObject>BCC.MSBuildLog.Program</StartupObject>
<AssemblyName>BCCMSBuildLog</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BCC-Core" Version="0.1.5" />
<PackageReference Include="FluentCommandLineParser" Version="1.4.3" Condition="'$(TargetFramework)' == 'net471'" />
<PackageReference Include="FluentCommandLineParser" Version="1.5.0.20-commands" />
<PackageReference Include="FluentCommandLineParser-netstandard" Version="1.4.3.13" Condition="'$(TargetFramework)' == 'netcoreapp2.1'" />
<PackageReference Include="JetBrains.Annotations" Version="2018.2.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0-preview3-35497" />
Expand Down
Loading

0 comments on commit 44b93e7

Please sign in to comment.