public void TestUnitSpecificProperty(Unit unit, String propertyName, Object inputValue, Object expectedOutputValue) { Console.WriteLine("\nTesting setting/getting a unit-specific property"); unit.SetProperty(propertyName, inputValue); Object outputValue = unit.GetProperty(propertyName); if (expectedOutputValue.Equals(outputValue)) Console.WriteLine("Test passed"); else Console.WriteLine("Test failed: " + outputValue + " didn't match " + expectedOutputValue); }
public void TestChangeProperty(Unit unit, String propertyName, Object inputValue, Object expectedOutputValue) { Console.WriteLine("\nTesting changing an existing property's value"); unit.SetProperty(propertyName, inputValue); Object outputValue = unit.GetProperty(propertyName); if (expectedOutputValue.Equals(outputValue)) Console.WriteLine("Test passed"); else Console.WriteLine("Test failed: " + outputValue + " didn't match " + expectedOutputValue); }
public void TestNonExistentProperty(Unit unit, String propertyName) { Console.WriteLine("\nTesting getting a non-existent property's value"); Object outputValue; try { outputValue = unit.GetProperty(propertyName); } catch (SystemException e) { Console.WriteLine("Test passed"); return; } Console.WriteLine("Test failed with value of " + outputValue); }