public Character getCharacter(bool useCache = true) { if(!useCache || this.character == null) { CharacterSheet cs = getApi().GetCharacterSheet(); character = new Character(cs.Name); character.attributes = new Dictionary<string, double>(); character.attributes.Add("Intelligence", cs.AttributeIntelligence); character.attributes.Add("Perception", cs.AttributePerception); character.attributes.Add("Charisma", cs.AttributeCharisma); character.attributes.Add("Willpower", cs.AttributeWillpower); character.attributes.Add("Memory", cs.AttributeMemory); character.attributeAugmentations = new Dictionary<string, double>(); character.attributeAugmentations.Add ("Intelligence", cs.AttributeIntelligenceTotal - cs.AttributeIntelligence); character.attributeAugmentations.Add ("Perception", cs.AttributePerceptionTotal - cs.AttributePerception); character.attributeAugmentations.Add ("Charisma", cs.AttributeCharismaTotal - cs.AttributeCharisma); character.attributeAugmentations.Add ("Willpower", cs.AttributeWillpowerTotal - cs.AttributeWillpower); character.attributeAugmentations.Add ("Memory", cs.AttributeMemoryTotal - cs.AttributeMemory); character.attributeTotals = new Dictionary<string,double> (); character.attributeTotals.Add ("Intelligence", cs.AttributeIntelligenceTotal); character.attributeTotals.Add ("Perception", cs.AttributePerceptionTotal); character.attributeTotals.Add ("Charisma", cs.AttributeCharismaTotal); character.attributeTotals.Add ("Willpower", cs.AttributeWillpowerTotal); character.attributeTotals.Add ("Memory", cs.AttributeMemoryTotal); } return this.character; }
public static void Main(string[] args) { Console.WriteLine ("Name: "); string inPutName = Console.ReadLine().ToString(); Character character = new Character(inPutName); Console.WriteLine("Your Character Name is: "+character.name); Console.WriteLine("The character's first name is: " +character.firstName); Console.WriteLine("The character's last name is: " +character.lastName); }
public void Should_have_a_first_name() { /** * Part 2. * * Add functionality to your character class to make this test pass. */ var character = new Character("Bank Hangflex"); Assert.AreEqual(character.firstName, "Bank"); }
public void Should_have_a_name() { /** * Part 1. * * Write the character class required to make this test * pass. * * You can run the test by pressing View/UnitTesting then * clicking the green down arrow on the left. * * After you've made it work, wire up the Main class to print * out the name of your character. * * We're not going to populate the character using the API yet * so don't get side tracked. */ var character = new Character("Hank Bangflex"); Assert.AreEqual(character.name, "Hank Bangflex"); }
public void Should_have_no_surname_inSingleWordName() { var character = new Character("Hank"); Assert.AreEqual(character.lastName, ""); }
public void Should_have_integer_value_in_attributes() { var character = new Character("Test Tester"); Assert.IsInstanceOfType(character, Character); }
public void Should_have_a_surname_inLongName() { var character = new Character("Hank B. Hangflex"); Assert.AreEqual(character.lastName, "Hangflex"); }
public void Should_have_a_surname() { var character = new Character("Firsty Lasty"); Assert.AreEqual(character.lastName, "Lasty"); }
public void Should_have_a_name() { var character = new Character("Hank Bangflex"); Assert.AreEqual(character.name, "Hank Bangflex"); }
public void Character_should_not_return_null() { var character = new Character("Hank Bangflex"); Assert.AreNotEqual(character,null); }