More unit tests for more fun!
This commit is contained in:
parent
7e3a38c5c1
commit
f89de33d01
5 changed files with 78 additions and 3 deletions
63
UnitTests/GroupManagerTest.cs
Normal file
63
UnitTests/GroupManagerTest.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
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 GroupManagerTest
|
||||
{
|
||||
public static IDbConnection DB;
|
||||
private GroupManager Groups;
|
||||
|
||||
[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();
|
||||
|
||||
Groups = new GroupManager(DB);
|
||||
TShock.Groups = this.Groups;
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestGroupsDBNotNull()
|
||||
{
|
||||
Assert.IsNotNull(Groups);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CreateGroup()
|
||||
{
|
||||
Assert.IsTrue(Groups.AddGroup("test1", "heal") != "");
|
||||
Assert.IsTrue(Groups.GroupExists("test1"));
|
||||
Assert.IsTrue(Tools.GetGroup("test1").HasPermission("heal"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void DeleteGroup()
|
||||
{
|
||||
Assert.IsTrue(Groups.AddGroup("test1", "heal") != "");
|
||||
Assert.IsTrue(Groups.GroupExists("test1"));
|
||||
Assert.IsTrue(Groups.DeleteGroup("test1") != "");
|
||||
Assert.IsFalse( Groups.GroupExists( "test1") );
|
||||
}
|
||||
|
||||
/*[TestMethod]
|
||||
public void CreateGroup()
|
||||
{
|
||||
Assert.IsTrue(Groups.AddGroup("test1", "heal") != "");
|
||||
Assert.IsTrue(Groups.GroupExists("test1"));
|
||||
Assert.IsTrue(Tools.GetGroup("test1").HasPermission("heal"));
|
||||
}*/
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue