public void can_create() { ILootEntry entry = new ValueLootEntry <string>("test"); Assert.IsNotNull(entry); Assert.IsInstanceOf <ValueLootEntry <string> >(entry); }
public void value_is_set() { const string VALUE = "test"; IValueLootEntry <string> entry = new ValueLootEntry <string>(VALUE); Assert.AreEqual(VALUE, entry.Value); }
public void prob_default_is_one() { const string VALUE = "test"; const double PROB = 1; ILootEntry entry = new ValueLootEntry <string>(VALUE); Assert.AreEqual(PROB, entry.Probability); }
public void prob_is_set() { const string VALUE = "test"; const double PROB = 1.2345; ILootEntry entry = new ValueLootEntry <string>(VALUE, PROB); Assert.AreEqual(PROB, entry.Probability); }
public void unique_default_is_false() { const string VALUE = "test"; const double PROB = 1.2345; const bool UNIQUE = false; ILootEntry entry = new ValueLootEntry <string>(VALUE, PROB); Assert.AreEqual(UNIQUE, entry.Unique); }
public void unique_is_set() { const string VALUE = "test"; const double PROB = 1.2345; const bool UNIQUE = true; ILootEntry entry = new ValueLootEntry <string>(VALUE, PROB, UNIQUE); Assert.AreEqual(UNIQUE, entry.Unique); }
public void guaranteed_default_is_false() { const string VALUE = "test"; const double PROB = 1.2345; const bool UNIQUE = true; const bool GUARANTEED = false; ILootEntry entry = new ValueLootEntry <string>(VALUE, PROB, UNIQUE); Assert.AreEqual(GUARANTEED, entry.Guaranteed); }
public void get_loot_returns_only_one_unique_entry() { const int COUNT = 15; ILootEntry UNIQUE_ENTRY = new ValueLootEntry <string>("test4", prob: 100, unique: true); ILootEntry[] LOOT_ENTRIES = new ILootEntry[] { new NullLootEntry(), new ValueLootEntry <string>("test1"), new ValueLootEntry <string>("test2"), new ValueLootEntry <string>("test3"), UNIQUE_ENTRY, }; LootTable table = new LootTable(COUNT, LOOT_ENTRIES); IReadOnlyCollection <ILootEntry> results = table.GetLoot(); Assert.LessOrEqual(1, results.Count(x => x == UNIQUE_ENTRY)); }