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
2 changes: 1 addition & 1 deletion src/Utility.Test/AsciiTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Utility.Test;

public class AsciiTest : TestContext
public class AsciiTest : BunitContext
{
public AsciiTest() {}

Expand Down
10 changes: 5 additions & 5 deletions src/Utility.Test/Base64Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Utility.Test;

public class Base64Test : TestContext
public class Base64Test : BunitContext
{
public Base64Test() {}

Expand All @@ -15,7 +15,7 @@ public void StringShouldDecode()
string output = string.Empty;
string expectedOutput = "AlexHedley";

var cut = RenderComponent<Base64>(parameters => parameters
var cut = Render<Base64>(parameters => parameters
.Add(p => p.Input, input)
.Add(p => p.Output, output)
);
Expand All @@ -36,7 +36,7 @@ public void StringShouldSkipOnEmptyDecode()
string output = string.Empty;
string expectedOutput = "";

var cut = RenderComponent<Base64>(parameters => parameters
var cut = Render<Base64>(parameters => parameters
.Add(p => p.Input, input)
.Add(p => p.Output, output)
);
Expand All @@ -57,7 +57,7 @@ public void StringShouldEncode()
string output = "AlexHedley";
string expectedInput = "QWxleEhlZGxleQ==";

var cut = RenderComponent<Base64>(parameters => parameters
var cut = Render<Base64>(parameters => parameters
.Add(p => p.Input, input)
.Add(p => p.Output, output)
);
Expand All @@ -78,7 +78,7 @@ public void StringShouldSkipOnEmptyEncode()
string output = string.Empty;
string expectedOutput = "";

var cut = RenderComponent<Base64>(parameters => parameters
var cut = Render<Base64>(parameters => parameters
.Add(p => p.Input, input)
.Add(p => p.Output, output)
);
Expand Down
4 changes: 2 additions & 2 deletions src/Utility.Test/BinaryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Utility.Test;

public class BinaryTest : TestContext
public class BinaryTest : BunitContext
{
public BinaryTest()
{
Expand All @@ -13,7 +13,7 @@ public BinaryTest()
// [Fact]
public void BinaryShouldConvertWhenClicked()
{
var cut = RenderComponent<Binary>();
var cut = Render<Binary>();
cut.Find("button").Click();

string markup = "";
Expand Down
4 changes: 2 additions & 2 deletions src/Utility.Test/EpochConverterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Utility.Test;

public class EpochConverterTest : TestContext
public class EpochConverterTest : BunitContext
{
//[Fact]
//public void FieldShouldClearWhenClicked()
//{
// var cut = RenderComponent<SQLBuilder>();
// var cut = Render<SQLBuilder>();
// cut.Find("btnFieldClear").Click();

// cut.Find("field").MarkupMatches("");
Expand Down
24 changes: 12 additions & 12 deletions src/Utility.Test/GuidGeneratorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Utility.Test
{
public class GuidGeneratorTest : TestContext
public class GuidGeneratorTest : BunitContext
{
public GuidGeneratorTest()
{
Expand All @@ -17,22 +17,22 @@ public GuidGeneratorTest()
[Fact]
public void ZeroGuidShouldExist()
{
var cut = RenderComponent<GuidGenerator>();
var cut = Render<GuidGenerator>();
string markup = "<input type=\"text\" id=\"guidZero\" name=\"guidZero\" class=\"form-control\" placeholder=\"00000000-0000-0000-0000-000000000000\" readonly=\"\" value=\"00000000-0000-0000-0000-000000000000\" >";
cut.FindAll("input")[0].MarkupMatches(markup);
}

// [Fact]
// public void ZeroGuidShouldCopyToClipboard()
// {
// var cut = RenderComponent<GuidGenerator>();
// var cut = Render<GuidGenerator>();
// cut.Find("button").Click();
// }

[Fact]
public void ZeroGuidShouldRemoveDashesWhenClicked()
{
var cut = RenderComponent<GuidGenerator>();
var cut = Render<GuidGenerator>();
cut.FindAll("input")[1].Change(true); //chkRemoveDashesZero
string markup = "<input type=\"text\" id=\"guidZero\" name=\"guidZero\" class=\"form-control\" placeholder=\"00000000-0000-0000-0000-000000000000\" readonly=\"\" value=\"00000000000000000000000000000000\" >";
cut.FindAll("input")[0].MarkupMatches(markup); //guidZero
Expand All @@ -41,7 +41,7 @@ public void ZeroGuidShouldRemoveDashesWhenClicked()
[Fact]
public void ZeroGuidShouldAddBracesWhenClicked()
{
var cut = RenderComponent<GuidGenerator>();
var cut = Render<GuidGenerator>();
cut.FindAll("input")[2].Change(true); //chkAddBracesZero
string markup = "<input type=\"text\" id=\"guidZero\" name=\"guidZero\" class=\"form-control\" placeholder=\"00000000-0000-0000-0000-000000000000\" readonly=\"\" value=\"{00000000-0000-0000-0000-000000000000}\">";
cut.FindAll("input")[0].MarkupMatches(markup); //guidZero
Expand All @@ -50,15 +50,15 @@ public void ZeroGuidShouldAddBracesWhenClicked()
// [Fact]
// public void NewGuidShouldExist()
// {
// var cut = RenderComponent<GuidGenerator>();
// var cut = Render<GuidGenerator>();
// string markup = "<input type=\"text\" id=\"newGuid\" name=\"newGuid\" class=\"form-control\" placeholder=\"00000000-0000-0000-0000-000000000000\" readonly=\"\">";
// cut.FindAll("input")[3].MarkupMatches(markup); //newGuid
// }

// [Fact]
// public void NewGuidShouldRemoveDashesWhenClicked()
// {
// var cut = RenderComponent<GuidGenerator>();
// var cut = Render<GuidGenerator>();
// cut.FindAll("input")[4].Change(true); //chkRemoveDashes
// string markup = "<input type=\"text\" id=\"newGuid\" name=\"newGuid\" class=\"form-control\" placeholder=\"00000000-0000-0000-0000-000000000000\" readonly=\"\">";
// cut.FindAll("input")[3].MarkupMatches(markup); // newGuid
Expand All @@ -67,22 +67,22 @@ public void ZeroGuidShouldAddBracesWhenClicked()
// [Fact]
// public void NewGuidShouldCopyToClipboard()
// {
// var cut = RenderComponent<GuidGenerator>();
// var cut = Render<GuidGenerator>();
// cut.Find("button").Click();
// }

[Fact]
public void MultipleDefaultIsFive()
{
var cut = RenderComponent<GuidGenerator>();
var cut = Render<GuidGenerator>();
string markup = "<input type=\"number\" class=\"form-control\" id=\"guidCount\" name=\"guidCount\" value=\"5\">";
cut.FindAll("input")[7].MarkupMatches(markup); // guidCount
}

// [Fact]
// public void MultipleClickShouldGenerateFive()
// {
// var cut = RenderComponent<GuidGenerator>();
// var cut = Render<GuidGenerator>();
// cut.FindAll("button")[3].Click();
// string markup = "<textarea id=\"guids\" class=\"form-control\" value=\"\" ></textarea>";
// cut.FindAll("textarea")[0].MarkupMatches(markup); // guids
Expand All @@ -91,14 +91,14 @@ public void MultipleDefaultIsFive()
// [Fact]
// public void MulitpleGuidShouldCopyToClipboard()
// {
// var cut = RenderComponent<GuidGenerator>();
// var cut = Render<GuidGenerator>();
// cut.FindAll("button")[4].Click();
// }

[Fact]
public void MultipleDeleteShouldBeEmpty()
{
var cut = RenderComponent<GuidGenerator>();
var cut = Render<GuidGenerator>();
cut.FindAll("button")[5].Click();
string markup = "<textarea id=\"guids\" class=\"form-control\" rows=\"5\" value=\"\"></textarea>";
cut.FindAll("textarea")[0].MarkupMatches(markup); // guids
Expand Down
4 changes: 2 additions & 2 deletions src/Utility.Test/HCFTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

namespace Utility.Test;

public class HCFTest : TestContext
public class HCFTest : BunitContext
{
public HCFTest()
{}

// [Fact]
public void HiddenCharacterFinderShouldFindHiddenCharacters()
{
var cut = RenderComponent<HCF>();
var cut = Render<HCF>();
// string markup = "";
// cut.FindAll("input")[0].MarkupMatches(markup);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Utility.Test/HTMLEncodeDecodeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Utility.Test;

public class HTMLEncodeDecodeTest : TestContext
public class HTMLEncodeDecodeTest : BunitContext
{
public HTMLEncodeDecodeTest()
{}
Expand All @@ -16,7 +16,7 @@ public void CanEncode()
var decoded = "&lt;html&gt;&lt;body&gt;&lt;h1&gt;Hello&lt;/h1&gt;&lt;/body&gt;&lt;/html&gt;";
var encoded = string.Empty;

var cut = RenderComponent<HTMLEncodeDecode>(parameters => parameters
var cut = Render<HTMLEncodeDecode>(parameters => parameters
.Add(p => p.Decoded, decoded)
.Add(p => p.Encoded, encoded)
);
Expand All @@ -34,7 +34,7 @@ public void CanDecode()
var decoded = string.Empty;
var encoded = "<html><body><h1>Hello</h1></body></html>";

var cut = RenderComponent<HTMLEncodeDecode>(parameters => parameters
var cut = Render<HTMLEncodeDecode>(parameters => parameters
.Add(p => p.Decoded, decoded)
.Add(p => p.Encoded, encoded)
);
Expand Down
2 changes: 1 addition & 1 deletion src/Utility.Test/HexToDecTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Utility.Test;

public class HexToDecTest : TestContext
public class HexToDecTest : BunitContext
{
public HexToDecTest() {}

Expand Down
4 changes: 2 additions & 2 deletions src/Utility.Test/HexToRGBTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Utility.Test;

public class ColourConverterTest : TestContext
public class ColourConverterTest : BunitContext
{
public ColourConverterTest()
{
Expand All @@ -13,7 +13,7 @@ public ColourConverterTest()
// [Fact]
public void MarkdownShouldConvertWhenClicked()
{
var cut = RenderComponent<HexToRGB>();
var cut = Render<HexToRGB>();
cut.Find("button").Click();

string markupRed = "";
Expand Down
4 changes: 2 additions & 2 deletions src/Utility.Test/JWTDebuggerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Utility.Test;

public class JWTDebuggerTest : TestContext
public class JWTDebuggerTest : BunitContext
{
public JWTDebuggerTest() {}

Expand All @@ -17,7 +17,7 @@ public void JwtTokenShouldDecode()
string expectedPayload = "{\"sub\":\"1234567890\",\"name\":\"John Doe\",\"iat\":1516239022}";
string exptectedSignature = "SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";

var cut = RenderComponent<JWTDebugger>(parameters => parameters
var cut = Render<JWTDebugger>(parameters => parameters
.Add(p => p.Input, input)
);

Expand Down
6 changes: 3 additions & 3 deletions src/Utility.Test/LuhnCheckerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Utility.Test;

public class LuhnCheckerTest : TestContext
public class LuhnCheckerTest : BunitContext
{
public LuhnCheckerTest()
{}
Expand All @@ -16,7 +16,7 @@ public void CheckLuhnWithInvalidShouldReturnFalse()
string input = "1";
bool valid = false;

var cut = RenderComponent<LuhnChecker>(parameters => parameters
var cut = Render<LuhnChecker>(parameters => parameters
.Add(p => p.check, input)
.Add(p => p.valid, valid)
);
Expand All @@ -33,7 +33,7 @@ public void CheckLuhnWithValidShouldReturnTrue()
string input = "378282246310005";
bool valid = true;

var cut = RenderComponent<LuhnChecker>(parameters => parameters
var cut = Render<LuhnChecker>(parameters => parameters
.Add(p => p.check, input)
.Add(p => p.valid, valid)
);
Expand Down
4 changes: 2 additions & 2 deletions src/Utility.Test/MD5ConverterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Utility.Test;

public class MD5ConverterTest: TestContext
public class MD5ConverterTest: BunitContext
{
public MD5ConverterTest()
{
Expand All @@ -13,7 +13,7 @@ public MD5ConverterTest()
// [Fact]
public void StringShouldConvertWhenClicked()
{
var cut = RenderComponent<MD5Converter>();
var cut = Render<MD5Converter>();
cut.Find("button").Click();

// string markup = "<textarea id=\"markdown\" class=\"form-control\" rows=\"5\" value=\"# Hello\"></textarea>";
Expand Down
13 changes: 8 additions & 5 deletions src/Utility.Test/MainLayoutTest.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
using System.Threading.Tasks;

using Blazored.LocalStorage;
using Bunit;
using Xunit;

using Utility.Shared;

namespace Utility.Test
{
public class MainLayoutTest : TestContext
//ILocalStorageService localStorage;

public class MainLayoutTest : BunitContext
{
// [Fact]
public async Task SavesNameToLocalStorage()
{
// Arrange
const string inputName = "John Smith";
var localStorage = this.AddBlazoredLocalStorage();
var cut = RenderComponent<MainLayout>();
//var localStorage = this.AddBlazoredLocalStorage();
var cut = Render<MainLayout>();

// Act
cut.Find("#Name").Change(inputName);
cut.Find("#NameButton").Click();

// Assert
var name = await localStorage.GetItemAsync<string>("name");
//var name = await localStorage.GetItemAsync<string>("name");

Assert.Equal(inputName, name);
//Assert.Equal(inputName, name);
}
}
}
Loading
Loading