public void Test_Find_FindsClassInDatabase() { Class testClass = new Class("Knight"); testClass.Save(); Class foundClass = Class.Find(testClass.GetId()); Assert.Equal(testClass, foundClass); }
public void Test_AddClass_AddsClassToItem() { Class testClass = new Class("Knight"); testClass.Save(); Item testItem = new Item("Sword", 0, "briefcase.jpg"); testItem.Save(); testItem.AddClass(testClass); List<Class> testList = new List<Class>{testClass}; List<Class> result = testItem.GetClasses(); Assert.Equal(testList, result); }
public void Test_Delete_DeletesClassFromDatabase() { Class testClass1 = new Class("Knight"); testClass1.Save(); Class testClass2 = new Class("Berserker"); testClass2.Save(); Class.Delete(testClass1.GetId()); List<Class> testList = new List<Class>{testClass2}; List<Class> resultList = Class.GetAll(); Assert.Equal(testList, resultList); }
public void Test_AddItem_AddsItemToClass() { Item testItem = new Item("Sword", 0, "briefcase.jpg"); testItem.Save(); Class testClass = new Class("Knight"); testClass.Save(); testClass.AddItem(testItem); List<Item> testList = new List<Item>{testItem}; List<Item> result = testClass.GetItems(); Assert.Equal(testList, result); }
public void Test_GetClasses_ReturnsAllItemsClasses() { Item testItem = new Item("sword", 0, "briefcase.jpg"); testItem.Save(); Class testClass1 = new Class("Knight"); testClass1.Save(); Class testClass2 = new Class("Berserker"); testClass2.Save(); testItem.AddClass(testClass1); testItem.AddClass(testClass2); List<Class> testList = new List<Class> {testClass1, testClass2}; List<Class> result = testItem.GetClasses(); Assert.Equal(testList, result); }
public void Test_GetItems_ReturnsAllClassItems() { Class testClass = new Class("Knight"); testClass.Save(); Item testItem1 = new Item("Sword", 0, "briefcase.jpg"); testItem1.Save(); Item testItem2 = new Item("Shield", 0, "briefcase.jpg"); testItem2.Save(); testClass.AddItem(testItem1); testClass.AddItem(testItem2); List<Item> testList = new List<Item> {testItem1, testItem2}; List<Item> result = testClass.GetItems(); Assert.Equal(testList, result); }
public void Test_Save_SavesToDatabase() { Class testClass = new Class("Knight"); testClass.Save(); List<Class> result = Class.GetAll(); List<Class> testList = new List<Class>{testClass}; Assert.Equal(testList, result); }
public void Test_Update_UpdatesClassWithNewValues() { Class testClass = new Class("Knight"); testClass.Save(); testClass.SetName("Berserker"); testClass.Update(); Class resultClass = Class.Find(testClass.GetId()); Class test = new Class("Berserker", testClass.GetId()); Assert.Equal(test, resultClass); }