public void ConvertItemToDatabaseModel() { // assign // act ItemDatabaseModel itemDatabaseModel = new ItemDatabaseModel(item, resourcesList); // assert Assert.IsNotNull(itemDatabaseModel); Assert.AreEqual(item.databaseID, itemDatabaseModel.databaseID); Assert.AreEqual(item.name, itemDatabaseModel.name); Assert.AreEqual(item.effects.Count, itemDatabaseModel.effectAndValues.Count); }
public void ConvertDatabaseModelToItem() { // assign ItemDatabaseModel itemDatabaseModel = new ItemDatabaseModel(item, resourcesList); // act Item newItem = itemDatabaseModel.databaseModelToItem(resourcesList); // assert Assert.IsNotNull(newItem); Assert.AreEqual(item.databaseID, newItem.databaseID); Assert.AreEqual(item.name, newItem.name); Assert.AreEqual(item.effects.Count, newItem.effects.Count); }
/// <summary> /// Display the form to add loot /// </summary> public void displayLootsForm() { EditorGUILayout.BeginVertical(GUILayout.Width(300)); for (int index = 0; index < numberOfLoot; index++) { EditorGUILayout.LabelField("Loot n° " + index + " : ", centerTitle); EditorGUILayout.BeginVertical("Box"); EditorGUILayout.LabelField("Item :", centerTitle); possibleLoots[index].isRandom = EditorGUILayout.Toggle("Is a random Item :", possibleLoots[index].isRandom); if (!possibleLoots[index].isRandom) { possibleLoots[index].itemDatabaseID = EditorGUILayout.IntField("Item Database Id : ", possibleLoots[index].itemDatabaseID); if (possibleLoots[index].itemDatabaseID != -1) { ItemDatabaseModel itemDatabaseModel = itemDatabase.getElementWithDBID(possibleLoots[index].itemDatabaseID); if (itemDatabaseModel != null) { EditorGUILayout.LabelField("Item name : ", itemDatabaseModel.name, new GUIStyle(GUI.skin.label) { fontStyle = FontStyle.Bold });; } else { EditorGUILayout.LabelField("Can't find this item..."); } } } else { possibleLoots[index].itemDatabaseID = -1; } EditorGUILayout.LabelField("Chance to drop :", centerTitle); possibleLoots[index].chanceToDrop = EditorGUILayout.FloatField(possibleLoots[index].chanceToDrop); if (!possibleLoots[index].isRandom) { EditorGUILayout.LabelField("Quantity :", centerTitle); possibleLoots[index].quantity = EditorGUILayout.IntField(possibleLoots[index].quantity); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndVertical(); }