Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Topic/fix xunit warnings #333

Merged
merged 7 commits into from Sep 13, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/Pretzel.Tests/Commands/BaseParameterTests.cs
Expand Up @@ -29,11 +29,11 @@ public void WriteOptions_WithNoParametersSpecified_DisplaysAll()

var output = writer.ToString();

Assert.True(output.Contains("--directory="));
Assert.True(output.Contains("--source="));
Assert.True(output.Contains("--debug"));
Assert.True(output.Contains("--help"));
Assert.True(output.Contains("--safe"));
Assert.Contains("--directory=", output);
Assert.Contains("--source=", output);
Assert.Contains("--debug", output);
Assert.Contains("--help", output);
Assert.Contains("--safe", output);
}

[Fact]
Expand Down
52 changes: 26 additions & 26 deletions src/Pretzel.Tests/Commands/CommandParameterOutputTests.cs
@@ -1,4 +1,4 @@
using Pretzel.Logic.Commands;
using Pretzel.Logic.Commands;
using Pretzel.Logic.Extensibility;
using System.IO;
using System.IO.Abstractions.TestingHelpers;
Expand All @@ -25,15 +25,15 @@ public void WriteOptions_WithNoParametersSpecified_DisplaysAll()

var output = writer.ToString();

Assert.True(output.Contains("-t"));
Assert.True(output.Contains("--template="));
Assert.True(output.Contains("--port="));
Assert.True(output.Contains("-i"));
Assert.True(output.Contains("--import="));
Assert.True(output.Contains("-f"));
Assert.True(output.Contains("--file="));
Assert.True(output.Contains("--cleantarget"));
Assert.True(output.Contains("--destination"));
Assert.Contains("-t", output);
Assert.Contains("--template=", output);
Assert.Contains("--port=", output);
Assert.Contains("-i", output);
Assert.Contains("--import=", output);
Assert.Contains("-f", output);
Assert.Contains("--file=", output);
Assert.Contains("--cleantarget", output);
Assert.Contains("--destination", output);
}

[Fact]
Expand All @@ -43,8 +43,8 @@ public void WriteOptions_WithOneParameterSpecified_DisplaysSelection()

var output = writer.ToString();

Assert.True(output.Contains("-t"));
Assert.True(output.Contains("--template="));
Assert.Contains("-t", output);
Assert.Contains("--template=", output);
}

[Fact]
Expand All @@ -54,12 +54,12 @@ public void WriteOptions_WithOneParameterSpecified_IgnoresOthers()

var output = writer.ToString();

Assert.False(output.Contains("-p"));
Assert.False(output.Contains("--port="));
Assert.False(output.Contains("-i"));
Assert.False(output.Contains("--import="));
Assert.False(output.Contains("-f"));
Assert.False(output.Contains("--file="));
Assert.DoesNotContain("-p", output);
Assert.DoesNotContain("--port=", output);
Assert.DoesNotContain("-i", output);
Assert.DoesNotContain("--import=", output);
Assert.DoesNotContain("-f", output);
Assert.DoesNotContain("--file=", output);
}

[Fact]
Expand All @@ -69,10 +69,10 @@ public void WriteOptions_WithTwoParameterSpecified_DisplaysSelection()

var output = writer.ToString();

Assert.True(output.Contains("-t"));
Assert.True(output.Contains("--template="));
Assert.True(output.Contains("-p"));
Assert.True(output.Contains("--port="));
Assert.Contains("-t", output);
Assert.Contains("--template=", output);
Assert.Contains("-p", output);
Assert.Contains("--port=", output);
}

[Fact]
Expand All @@ -82,10 +82,10 @@ public void WriteOptions_WithTwoParameterSpecified_IgnoresOthers()

var output = writer.ToString();

Assert.False(output.Contains("-i"));
Assert.False(output.Contains("--import="));
Assert.False(output.Contains("-f"));
Assert.False(output.Contains("--file="));
Assert.DoesNotContain("-i", output);
Assert.DoesNotContain("--import=", output);
Assert.DoesNotContain("-f", output);
Assert.DoesNotContain("--file=", output);
}
}
}
24 changes: 12 additions & 12 deletions src/Pretzel.Tests/Extensibility/Extensions/AzureHostSupportTest.cs
@@ -1,4 +1,4 @@
using NDesk.Options;
using NDesk.Options;
using Pretzel.Logic.Extensibility.Extensions;
using System.IO.Abstractions.TestingHelpers;
using System.Linq;
Expand Down Expand Up @@ -28,7 +28,7 @@ public void GetArguments_Create_Should_Return_Azure(string command)
var args = azureHostSupport.GetArguments(command);

// assert
Assert.Equal(1, args.Length);
Assert.Single(args);
Assert.Equal("-azure", args[0]);
}

Expand All @@ -43,7 +43,7 @@ public void GetArguments_Default_Should_Return_Empty_Array(string command)
var args = azureHostSupport.GetArguments(command);

// assert
Assert.Equal(0, args.Length);
Assert.Empty(args);
}

[Fact]
Expand All @@ -55,7 +55,7 @@ public void UpdateOptions_Should_Add_Azure()
azureHostSupport.UpdateOptions(optionSet);

// assert
Assert.Equal(1, optionSet.Count);
Assert.Single(optionSet);
Assert.Equal("azure", optionSet[0].Prototype);
Assert.NotNull(optionSet[0].Description);
}
Expand Down Expand Up @@ -94,14 +94,14 @@ public void MixIn_AzureActivated_AllFilesAreIncluded()
azureHostSupport.MixIn(@"c:\website");

// assert
Assert.True(fileSystem.AllDirectories.Contains(@"c:\website\_source\"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\website\_source\index.md"));
Assert.True(fileSystem.AllDirectories.Contains(@"c:\website\_source\_posts\"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\website\Shim.cs"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\website\Shim.csproj"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\website\Shim.sln"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\website\Pretzel.exe"));
Assert.Contains(@"c:\website\_source\", fileSystem.AllDirectories);
Assert.Contains(@"c:\website\_source\index.md", fileSystem.AllFiles);
Assert.Contains(@"c:\website\_source\_posts\", fileSystem.AllDirectories);
Assert.Contains(@"c:\website\Shim.cs", fileSystem.AllFiles);
Assert.Contains(@"c:\website\Shim.csproj", fileSystem.AllFiles);
Assert.Contains(@"c:\website\Shim.sln", fileSystem.AllFiles);
Assert.Contains(@"c:\website\Pretzel.exe", fileSystem.AllFiles);
}

}
}
}
Expand Up @@ -158,7 +158,7 @@ public void GetArguments_Bake_Or_Taste_Should_Return_VDir(string command)
var args = vdirSupport.GetArguments(command);

// assert
Assert.Equal(1, args.Length);
Assert.Single(args);
Assert.Equal("-vDir", args[0]);
}

Expand All @@ -172,7 +172,7 @@ public void GetArguments_Default_Should_Return_Empty_Array(string command)
var args = vdirSupport.GetArguments(command);

// assert
Assert.Equal(0, args.Length);
Assert.Empty(args);
}
}
}
6 changes: 3 additions & 3 deletions src/Pretzel.Tests/Import/BloggerImportTests.cs
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Globalization;
using Xunit;
Expand Down Expand Up @@ -88,7 +88,7 @@ public void Posts_Are_Imported()
var header = postContent.YamlHeader();

Assert.Equal("Hello World 1", header["title"].ToString());
Assert.Equal(0, ((List<string>)header["tags"]).Count);
Assert.Empty(((List<string>)header["tags"]));

string expectedPost2 = @"_posts\2000-09-07-Hello-World-2.md";
Assert.True(fileSystem.File.Exists(BaseSite + expectedPost2));
Expand All @@ -98,7 +98,7 @@ public void Posts_Are_Imported()

Assert.Equal("Hello World 2", header2["title"].ToString());
var tags = (List<string>)header2["tags"];
Assert.Equal(1, tags.Count);
Assert.Single(tags);
Assert.Equal("aTag", tags[0]);
}

Expand Down
6 changes: 3 additions & 3 deletions src/Pretzel.Tests/Minification/LessTransformTests.cs
@@ -1,4 +1,4 @@
using Pretzel.Logic.Minification;
using Pretzel.Logic.Minification;
using Pretzel.Logic.Templating.Context;
using System.Collections.Generic;
using System.IO.Abstractions.TestingHelpers;
Expand Down Expand Up @@ -200,7 +200,7 @@ public void Should_Not_Process_Exernal_Css_File()
// assert
// No css file have been generated
Assert.Equal(2, fileSystem.AllPaths.Count());
Assert.False(fileSystem.AllPaths.Any(p => p.EndsWith(".css")));
Assert.DoesNotContain(fileSystem.AllPaths, p => p.EndsWith(".css"));
}

[Fact]
Expand Down Expand Up @@ -250,7 +250,7 @@ public void If_no_corresponding_less_file_nothing_is_done()
// assert
// No css file have been generated
Assert.Equal(2, fileSystem.AllPaths.Count());
Assert.False(fileSystem.AllPaths.Any(p => p.EndsWith(".css")));
Assert.DoesNotContain(fileSystem.AllPaths, p => p.EndsWith(".css"));
}

[Fact]
Expand Down
2 changes: 1 addition & 1 deletion src/Pretzel.Tests/Pretzel.Tests.csproj
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ProductVersion>8.0.30703</ProductVersion>
<TargetFramework>net462</TargetFramework>
Expand Down
4 changes: 3 additions & 1 deletion src/Pretzel.Tests/PretzelContext.cs
@@ -1,11 +1,13 @@
namespace Pretzel.Tests
namespace Pretzel.Tests
{
public abstract class SpecificationFor<T>
{
public T Subject;

public abstract T Given();
#pragma warning disable xUnit1013 //This is part of design, analyzer does not check for abstract methods correctly
public abstract void When();
#pragma warning restore xUnit1013

protected SpecificationFor()
{
Expand Down
38 changes: 19 additions & 19 deletions src/Pretzel.Tests/Recipe/RecipeTests.cs
Expand Up @@ -54,7 +54,7 @@ public void Files_and_Folders_Are_Created_for_Jekyll()
Assert.True(fileSystem.File.Exists(BaseSite + @"img\favicon.ico"));
Assert.True(fileSystem.File.Exists(BaseSite + @"_includes\head.html"));

Assert.True(trace.ToString().Contains("Pretzel site template has been created"));
Assert.Contains("Pretzel site template has been created", trace.ToString());
}

[Theory]
Expand Down Expand Up @@ -99,7 +99,7 @@ public void Files_and_Folders_Are_Created_for_Razor(bool wiki)
Assert.Equal(!wiki, fileSystem.File.Exists(BaseSite + "atom.xml"));
Assert.Equal(!wiki, fileSystem.File.Exists(BaseSite + "sitemap.xml"));

Assert.True(trace.ToString().Contains("Pretzel site template has been created"));
Assert.Contains("Pretzel site template has been created", trace.ToString());
}

[Fact]
Expand All @@ -110,7 +110,7 @@ public void Other_Engine_returns_error()

recipe.Create();

Assert.True(trace.ToString().Contains("Templating Engine not found"));
Assert.Contains("Templating Engine not found", trace.ToString());
}

[Fact]
Expand Down Expand Up @@ -154,7 +154,7 @@ public void liquid_engine_with_wiki()
var recipe = new Logic.Recipe.Recipe(fileSystem, "liquid", BaseSite, Enumerable.Empty<IAdditionalIngredient>(), false, true);
recipe.Create();

Assert.True(trace.ToString().Contains("Wiki switch not valid with liquid templating engine"));
Assert.Contains("Wiki switch not valid with liquid templating engine", trace.ToString());
}

[Fact]
Expand All @@ -166,21 +166,21 @@ public void razor_engine_with_project()
recipe.Create();

Assert.Equal(40, fileSystem.AllPaths.Count());
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\Properties\AssemblyInfo.cs"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\PretzelClasses\Category.cs"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\LayoutProject.csproj"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\layoutSolution.sln"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\PretzelClasses\NonProcessedPage.cs"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\.nuget\NuGet.config"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\.nuget\NuGet.exe"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\.nuget\NuGet.targets"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\PretzelClasses\PageContext.cs"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\PretzelClasses\Page.cs"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\PretzelClasses\Paginator.cs"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\PretzelClasses\SiteContext.cs"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\PretzelClasses\Tag.cs"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\web.config"));
Assert.True(fileSystem.AllFiles.Contains(@"c:\site\_layouts\packages.config"));
Assert.Contains(@"c:\site\_layouts\Properties\AssemblyInfo.cs", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\PretzelClasses\Category.cs", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\LayoutProject.csproj", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\layoutSolution.sln", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\PretzelClasses\NonProcessedPage.cs", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\.nuget\NuGet.config", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\.nuget\NuGet.exe", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\.nuget\NuGet.targets", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\PretzelClasses\PageContext.cs", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\PretzelClasses\Page.cs", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\PretzelClasses\Paginator.cs", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\PretzelClasses\SiteContext.cs", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\PretzelClasses\Tag.cs", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\web.config", fileSystem.AllFiles);
Assert.Contains(@"c:\site\_layouts\packages.config", fileSystem.AllFiles);
}

[Fact]
Expand Down