From c3dbf8b3eace972e0d5021a46f566dc9f5baecbd Mon Sep 17 00:00:00 2001 From: 13xforever Date: Mon, 5 Nov 2018 19:33:30 +0500 Subject: [PATCH] Test project --- .gitignore | 1 + Tests/Test Files/Put IRD files here.txt | 1 + Tests/Tests.csproj | 25 +++++++++++++++++++++++++ Tests/UnitTest1.cs | 24 ++++++++++++++++++++++++ discord-bot-net.sln | 7 ++++++- 5 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 Tests/Test Files/Put IRD files here.txt create mode 100644 Tests/Tests.csproj create mode 100644 Tests/UnitTest1.cs diff --git a/.gitignore b/.gitignore index e3dbfb21..4570f08f 100644 --- a/.gitignore +++ b/.gitignore @@ -264,3 +264,4 @@ launchSettings.json *.db *.db-journal logs/ +*.ird diff --git a/Tests/Test Files/Put IRD files here.txt b/Tests/Test Files/Put IRD files here.txt new file mode 100644 index 00000000..5f282702 --- /dev/null +++ b/Tests/Test Files/Put IRD files here.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj new file mode 100644 index 00000000..9a435948 --- /dev/null +++ b/Tests/Tests.csproj @@ -0,0 +1,25 @@ + + + + netcoreapp2.1 + + false + + + + + + + + + + + + + + + Always + + + + diff --git a/Tests/UnitTest1.cs b/Tests/UnitTest1.cs new file mode 100644 index 00000000..5394602b --- /dev/null +++ b/Tests/UnitTest1.cs @@ -0,0 +1,24 @@ +using System.IO; +using IrdLibraryClient.IrdFormat; +using NUnit.Framework; + +namespace Tests +{ + [TestFixture] + public class IrdTests + { + [Test] + public void ParsingTest() + { + var baseDir = TestContext.CurrentContext.TestDirectory; + var testFiles = Directory.GetFiles(baseDir, "*.ird", SearchOption.AllDirectories); + Assert.That(testFiles.Length, Is.GreaterThan(0)); + + foreach (var file in testFiles) + { + var bytes = File.ReadAllBytes(file); + Assert.That(() => IrdParser.Parse(bytes), Throws.Nothing); + } + } + } +} diff --git a/discord-bot-net.sln b/discord-bot-net.sln index 4601362b..1e8c473f 100644 --- a/discord-bot-net.sln +++ b/discord-bot-net.sln @@ -11,7 +11,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PsnClient", "PsnClient\PsnC EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HomoglyphConverter", "HomoglyphConverter\HomoglyphConverter.csproj", "{A1E6566C-F506-43C8-B06E-9A472AEBF447}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IrdLibraryClient", "IrdLibraryClient\IrdLibraryClient.csproj", "{AA2A333B-CD30-41A5-A680-CC9BCB2D726B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IrdLibraryClient", "IrdLibraryClient\IrdLibraryClient.csproj", "{AA2A333B-CD30-41A5-A680-CC9BCB2D726B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{815D60C3-F84B-4AE2-B4E4-48004515FCFD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -39,6 +41,9 @@ Global {AA2A333B-CD30-41A5-A680-CC9BCB2D726B}.Debug|Any CPU.Build.0 = Debug|Any CPU {AA2A333B-CD30-41A5-A680-CC9BCB2D726B}.Release|Any CPU.ActiveCfg = Release|Any CPU {AA2A333B-CD30-41A5-A680-CC9BCB2D726B}.Release|Any CPU.Build.0 = Release|Any CPU + {815D60C3-F84B-4AE2-B4E4-48004515FCFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {815D60C3-F84B-4AE2-B4E4-48004515FCFD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {815D60C3-F84B-4AE2-B4E4-48004515FCFD}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE