diff --git a/.appveyor.yml b/.appveyor.yml
index b48267a..15aac26 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -10,14 +10,14 @@ build_script:
- dotnet build -c Release
test_script:
- ps: >-
- nuget install xunit.runner.console -OutputDirectory packages -Version 2.3.1
+ dotnet test
+ &('dotnet') ('test', './CommunityBot.NUnit.Tests/Justine.NUnit.Tests.csproj', '/p:CollectCoverage=true', '/p:"Include=[CommunityBot]*"', '/p:"Exclude=[NUnit3.TestAdapter]*"', '/p:CoverletOutputFormat=opencover')
+
nuget install OpenCover -OutputDirectory packages -Version 4.6.519
dotnet tool install coveralls.net --version 1.0.0 --tool-path tools
-
- .\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe -register:user -target:"C:\Program Files\dotnet\dotnet.exe" "-targetargs:"".\packages\xunit.runner.console.2.3.1\tools\netcoreapp2.0\xunit.console.dll"" ""CommunityBot.Tests\bin\Release\netcoreapp2.0\CommunityBot.Tests.dll"" -noshadow -appveyor" -filter:"+[CommunityBot*]* -[CommunityBot*]*Tests.* -[CommunityBot*]*AutoGeneratedProgram" -oldStyle -output:opencoverCoverage.xml
-
+
$coveralls = ".\tools\csmacnz.coveralls.exe"
if (Get-Variable 'COVERALLS_REPO_TOKEN' -Scope Global -ErrorAction 'Ignore') {
diff --git a/CommunityBot.Tests/ApplicationSettingsTests.cs b/CommunityBot.NUnit.Tests/ApplicationSettingsTests.cs
similarity index 90%
rename from CommunityBot.Tests/ApplicationSettingsTests.cs
rename to CommunityBot.NUnit.Tests/ApplicationSettingsTests.cs
index ca6d0d8..ef26acc 100644
--- a/CommunityBot.Tests/ApplicationSettingsTests.cs
+++ b/CommunityBot.NUnit.Tests/ApplicationSettingsTests.cs
@@ -2,35 +2,35 @@
using CommunityBot.Configuration;
using Discord;
using Moq;
-using Xunit;
+using NUnit.Framework;
namespace CommunityBot.Tests
{
public class ApplicationSettingsTests
{
- [Fact]
+ [Test]
public void HeadlessArgumentTest()
{
var settings = new ApplicationSettings(new []{ "-hl" });
Assert.True(settings.Headless);
}
- [Fact]
+ [Test]
public void VerboseArgumentTest()
{
var settings = new ApplicationSettings(new []{ "-vb" });
Assert.True(settings.Verbose);
}
- [Fact]
+ [Test]
public void CacheSizeArgumentTest()
{
const int expected = 999;
var settings = new ApplicationSettings(new []{ $"-cs={expected}" });
- Assert.Equal(expected, settings.CacheSize);
+ Assert.AreEqual(expected, settings.CacheSize);
}
- [Fact]
+ [Test]
public void LogDestinationArgument_FileTest()
{
var settings = new ApplicationSettings(new []{ "-log=f" });
@@ -38,7 +38,7 @@ public void LogDestinationArgument_FileTest()
Assert.False(settings.LogIntoConsole);
}
- [Fact]
+ [Test]
public void LogDestinationArgument_ConsoleTest()
{
var settings = new ApplicationSettings(new []{ "-log=c" });
@@ -46,7 +46,7 @@ public void LogDestinationArgument_ConsoleTest()
Assert.False(settings.LogIntoFile);
}
- [Fact]
+ [Test]
public void LogDestinationArgument_ConsoleDefaultTest()
{
var settings = new ApplicationSettings(new []{ "" });
@@ -54,7 +54,7 @@ public void LogDestinationArgument_ConsoleDefaultTest()
Assert.False(settings.LogIntoFile);
}
- [Fact]
+ [Test]
public void LogDestinationArgument_BothTest()
{
var settings = new ApplicationSettings(new []{ "-log=cf" });
diff --git a/CommunityBot.NUnit.Tests/CommunityBot.NUnit.Tests.csproj b/CommunityBot.NUnit.Tests/CommunityBot.NUnit.Tests.csproj
new file mode 100644
index 0000000..b6169e1
--- /dev/null
+++ b/CommunityBot.NUnit.Tests/CommunityBot.NUnit.Tests.csproj
@@ -0,0 +1,16 @@
+
+
+ netcoreapp2.0
+ false
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CommunityBot.Tests/FeatureTests/RoleByPhraseTests.cs b/CommunityBot.NUnit.Tests/FeatureTests/RoleByPhraseTests.cs
similarity index 90%
rename from CommunityBot.Tests/FeatureTests/RoleByPhraseTests.cs
rename to CommunityBot.NUnit.Tests/FeatureTests/RoleByPhraseTests.cs
index 40b17d4..e033306 100644
--- a/CommunityBot.Tests/FeatureTests/RoleByPhraseTests.cs
+++ b/CommunityBot.NUnit.Tests/FeatureTests/RoleByPhraseTests.cs
@@ -1,6 +1,6 @@
using System;
using CommunityBot.Features.RoleAssignment;
-using Xunit;
+using NUnit.Framework;
namespace CommunityBot.Tests.FeatureTests
{
@@ -47,7 +47,7 @@ private static RoleByPhraseSettings GetFilledSettings()
};
}
- [Fact]
+ [Test]
public void Rbp_RemoveRelationTest()
{
const int expectedRelCount = 3;
@@ -56,10 +56,10 @@ public void Rbp_RemoveRelationTest()
rbps.RemoveRelation(0, 0);
var actual = rbps.Relations.Count;
- Assert.Equal(expectedRelCount, actual);
+ Assert.AreEqual(expectedRelCount, actual);
}
- [Fact]
+ [Test]
public void Rbp_RemoveRelationTest_ArgEx()
{
var rbps = GetFilledSettings();
@@ -72,14 +72,14 @@ public void Rbp_RemoveRelationTest_ArgEx()
Assert.Throws(() => rbps.RemoveRelation(invalidIndex, invalidIndex));
}
- [Fact]
+ [Test]
public void Rbp_RemoveRelationTest_RelNotFoundEx()
{
var rbps = GetFilledSettings();
Assert.Throws(() => rbps.RemoveRelation(1,1));
}
- [Fact]
+ [Test]
public void Rbp_AddRelationTest()
{
const int expectedRelCount = 5;
@@ -88,10 +88,10 @@ public void Rbp_AddRelationTest()
rbps.CreateRelation(0, 2);
var acutal = rbps.Relations.Count;
- Assert.Equal(expectedRelCount, acutal);
+ Assert.AreEqual(expectedRelCount, acutal);
}
- [Fact]
+ [Test]
public void Rbp_AddRelationTest_ArgEx()
{
var rbps = GetFilledSettings();
@@ -104,14 +104,14 @@ public void Rbp_AddRelationTest_ArgEx()
Assert.Throws(() => rbps.CreateRelation(invalidIndex, invalidIndex));
}
- [Fact]
+ [Test]
public void Rbp_AddRelationTest_RelExists()
{
var rbps = GetFilledSettings();
Assert.Throws(() => rbps.CreateRelation(1, 0));
}
- [Fact]
+ [Test]
public void Rbp_AddPhraseTest()
{
const int expected = 3;
@@ -120,24 +120,24 @@ public void Rbp_AddPhraseTest()
rbps.AddPhrase("CC");
var actual = rbps.Phrases.Count;
- Assert.Equal(expected, actual);
+ Assert.AreEqual(expected, actual);
}
- [Fact]
+ [Test]
public void Rbp_AddPhraseTest_InvalidPhraseEx()
{
var rbps = GetFilledSettings();
Assert.Throws(() => rbps.AddPhrase(string.Empty));
}
- [Fact]
+ [Test]
public void Rbp_AddPhraseTest_InvalidPhraseEx_TooLong()
{
var rbps = GetFilledSettings();
Assert.Throws(() => rbps.AddPhrase(new string('A', Constants.MaxMessageLength)));
}
- [Fact]
+ [Test]
public void Rbp_RemovePhraseTest()
{
const int expected = 1;
@@ -146,10 +146,10 @@ public void Rbp_RemovePhraseTest()
rbps.RemovePhraseByIndex(1);
var actual = rbps.Phrases.Count;
- Assert.Equal(expected, actual);
+ Assert.AreEqual(expected, actual);
}
- [Fact]
+ [Test]
public void Rbp_AddRoleTest()
{
const int expected = 4;
@@ -158,17 +158,17 @@ public void Rbp_AddRoleTest()
rbps.AddRole(123);
var actual = rbps.RolesIds.Count;
- Assert.Equal(expected, actual);
+ Assert.AreEqual(expected, actual);
}
- [Fact]
+ [Test]
public void Rbp_AddRoleTest_AlreadyAddedEx()
{
var rbps = GetFilledSettings();
Assert.Throws(() => rbps.AddRole(111));
}
- [Fact]
+ [Test]
public void Rbp_RemoveRoleTest()
{
const int expected = 2;
@@ -177,7 +177,7 @@ public void Rbp_RemoveRoleTest()
rbps.RemoveRoleIdByIndex(0);
var actual = rbps.RolesIds.Count;
- Assert.Equal(expected, actual);
+ Assert.AreEqual(expected, actual);
}
}
}
diff --git a/CommunityBot.Tests/GlobalTests.cs b/CommunityBot.NUnit.Tests/GlobalTests.cs
similarity index 94%
rename from CommunityBot.Tests/GlobalTests.cs
rename to CommunityBot.NUnit.Tests/GlobalTests.cs
index a93d8d3..b1a3a4d 100644
--- a/CommunityBot.Tests/GlobalTests.cs
+++ b/CommunityBot.NUnit.Tests/GlobalTests.cs
@@ -1,13 +1,13 @@
using Castle.Core.Resource;
using Discord;
using Moq;
-using Xunit;
+using NUnit.Framework;
namespace CommunityBot.Tests
{
public class GlobalTests
{
- [Fact]
+ [Test]
public void ReplacePlaceholderString_NoNicknameTest()
{
const string expected = "Username";
@@ -15,7 +15,7 @@ public void ReplacePlaceholderString_NoNicknameTest()
TestReplacePlaceholderString("", expected, guildUser);
}
- [Fact]
+ [Test]
public void ReplacePlaceholderString_ValidUsernameTest()
{
const string expected = "Nickname";
@@ -23,7 +23,7 @@ public void ReplacePlaceholderString_ValidUsernameTest()
TestReplacePlaceholderString("", expected, guildUser);
}
- [Fact]
+ [Test]
public void ReplacePlaceholderString_GuildNameTest()
{
const string expected = "TestGuildName";
@@ -31,7 +31,7 @@ public void ReplacePlaceholderString_GuildNameTest()
TestReplacePlaceholderString("", expected, guildUser);
}
- [Fact]
+ [Test]
public void ReplacePlaceholderString_UserMentionTest()
{
const string expected = "@JonDoe";
@@ -39,7 +39,7 @@ public void ReplacePlaceholderString_UserMentionTest()
TestReplacePlaceholderString("", expected, guildUser);
}
- [Fact]
+ [Test]
public void ReplacePlaceholderString_Multiple()
{
const string expected = "Hello, Peter! Welcome to MyCoolGuild!";
@@ -47,7 +47,7 @@ public void ReplacePlaceholderString_Multiple()
TestReplacePlaceholderString("Hello, ! Welcome to !", expected, guildUser);
}
- [Fact]
+ [Test]
public void ReplacePlaceholderString_MultipleNoNickname()
{
const string expected = "Hello, spelos! Welcome to MyCoolGuild!";
@@ -58,7 +58,7 @@ public void ReplacePlaceholderString_MultipleNoNickname()
private static void TestReplacePlaceholderString(string input, string expected, IMock user)
{
var actual = input.ReplacePlacehoderStrings(user.Object);
- Assert.Equal(expected, actual);
+ Assert.AreEqual(expected, actual);
}
private static Mock CreateMockGuildUser(string nickname, string username, string guildName = "MyGuild", string userMention = "@User")
diff --git a/CommunityBot.Tests/ImmutableConstantsTests.cs b/CommunityBot.NUnit.Tests/ImmutableConstantsTests.cs
similarity index 93%
rename from CommunityBot.Tests/ImmutableConstantsTests.cs
rename to CommunityBot.NUnit.Tests/ImmutableConstantsTests.cs
index 51a1fc9..a224e64 100644
--- a/CommunityBot.Tests/ImmutableConstantsTests.cs
+++ b/CommunityBot.NUnit.Tests/ImmutableConstantsTests.cs
@@ -1,11 +1,11 @@
using System;
-using Xunit;
+using NUnit.Framework;
namespace CommunityBot.Tests
{
public static class ImmutableConstantsTests
{
- [Fact]
+ [Test]
public static void ConstantArrayIsImmutableTest()
{
Assert.Throws(() => Constants.DidYouKnows.Add("Hello, World!"));
diff --git a/CommunityBot.Tests/CommunityBot.Tests.csproj b/CommunityBot.Tests/CommunityBot.Tests.csproj
deleted file mode 100644
index 81ac76d..0000000
--- a/CommunityBot.Tests/CommunityBot.Tests.csproj
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
- netcoreapp2.0
- full
- false
-
-
-
-
-
-
-
-
-
-
-
-
- ..\..\..\..\Users\Spelos\.nuget\packages\discord.net.core\1.0.2\lib\netstandard1.1\Discord.Net.Core.dll
-
-
-
-
-
-
diff --git a/CommunityBot.sln b/CommunityBot.sln
index 2a9839f..bd690e4 100644
--- a/CommunityBot.sln
+++ b/CommunityBot.sln
@@ -5,7 +5,7 @@ VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityBot", "CommunityBot\CommunityBot.csproj", "{82B51A90-044B-4F54-91A0-AA9AF8D7EEAE}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityBot.Tests", "CommunityBot.Tests\CommunityBot.Tests.csproj", "{5C95BE8F-63F6-4289-B91C-42DFE61E784C}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommunityBot.NUnit.Tests", "CommunityBot.NUnit.Tests\CommunityBot.NUnit.Tests.csproj", "{CE128E01-DC44-4D2C-B011-FAE0DD2157C9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -17,10 +17,10 @@ Global
{82B51A90-044B-4F54-91A0-AA9AF8D7EEAE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{82B51A90-044B-4F54-91A0-AA9AF8D7EEAE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{82B51A90-044B-4F54-91A0-AA9AF8D7EEAE}.Release|Any CPU.Build.0 = Release|Any CPU
- {5C95BE8F-63F6-4289-B91C-42DFE61E784C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5C95BE8F-63F6-4289-B91C-42DFE61E784C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5C95BE8F-63F6-4289-B91C-42DFE61E784C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5C95BE8F-63F6-4289-B91C-42DFE61E784C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CE128E01-DC44-4D2C-B011-FAE0DD2157C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CE128E01-DC44-4D2C-B011-FAE0DD2157C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CE128E01-DC44-4D2C-B011-FAE0DD2157C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CE128E01-DC44-4D2C-B011-FAE0DD2157C9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE