diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs index 940ebf8a..94d8f48f 100644 --- a/TShockAPI/Properties/AssemblyInfo.cs +++ b/TShockAPI/Properties/AssemblyInfo.cs @@ -35,5 +35,5 @@ using System.Runtime.InteropServices; // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.0.2.0722")] -[assembly: AssemblyFileVersion("3.0.2.0722")] +[assembly: AssemblyVersion("3.0.2.0723")] +[assembly: AssemblyFileVersion("3.0.2.0723")] diff --git a/UnitTests/BanManagerTest.cs b/UnitTests/BanManagerTest.cs new file mode 100644 index 00000000..e7c206c4 --- /dev/null +++ b/UnitTests/BanManagerTest.cs @@ -0,0 +1,53 @@ +using System; +using System.Data; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Community.CsharpSqlite.SQLiteClient; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using TShockAPI; +using TShockAPI.DB; + +namespace UnitTests +{ + [TestClass] + public class BanManagerTest + { + public static IDbConnection DB; + private BanManager Bans; + + [TestInitialize] + public void Initialize() + { + TShock.Config = new ConfigFile(); + TShock.Config.StorageType = "sqlite"; + + DB = new SqliteConnection(string.Format("uri=file://{0},Version=3", "tshock.test.sqlite")); + DB.Open(); + + Bans = new BanManager(DB); + } + + [TestMethod] + public void TestDBNotNull() + { + Assert.IsNotNull(Bans); + } + + [TestMethod] + public void AddBanTest() + { + Assert.IsTrue(Bans.AddBan("127.0.0.1", "BanTest", "Ban Testing")); + } + + [TestMethod] + public void FindBanTest() + { + Assert.IsNotNull(Bans.GetBanByIp("127.0.0.1")); + TShock.Config.EnableBanOnUsernames = true; + Assert.IsNotNull(Bans.GetBanByName("BanTest")); + TShock.Config.EnableBanOnUsernames = false; + Assert.IsNull(Bans.GetBanByName("BanTest")); + } + } +} diff --git a/UnitTests/BanManagerTest.orderedtest b/UnitTests/BanManagerTest.orderedtest new file mode 100644 index 00000000..1d93a5b5 --- /dev/null +++ b/UnitTests/BanManagerTest.orderedtest @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj index 10392952..ec6af728 100644 --- a/UnitTests/UnitTests.csproj +++ b/UnitTests/UnitTests.csproj @@ -63,6 +63,7 @@ + @@ -73,6 +74,9 @@ + + Always + Always