private void GetBlankPrimaryTab(CharacterVM vm) { PrimaryTabVM primaryTab = new PrimaryTabVM(); GetSelectableRaces(primaryTab); ClassRowCM[] selectedClasses = new ClassRowCM[1]; selectedClasses[0] = new ClassRowCM { Index = 1 }; GetSelectableClasses(selectedClasses); primaryTab.Classes = new ClassesCM { SelectedClasses = selectedClasses }; primaryTab.Stats = new StatsCM { Bonus = new StatBonusCM() }; primaryTab.Saves = new SavesCM(); primaryTab.Combat = new CombatCM(); primaryTab.Skills = new ProficiencyCM { isProficient = new IsProficientCM(), TotalBonus = new SkillBonusCM() }; vm.PrimaryTab = primaryTab; }
private void GetSelectableRaces(PrimaryTabVM primaryTab) { List <RaceListModel> races = new List <RaceListModel>(); //Get foundRaces from userAccess List <Race> foundRaces = _userAccess.GetAllRaces().ToList(); //foreach race in foundRaces, foreach (Race race in foundRaces) { RaceListModel lm = CharacterMapper.mapRaceToRaceListModel(race); races.Add(lm); } primaryTab.Races = races; }
private CharacterVM buildPOSTArgument() { ClassesCM postedClasses = new ClassesCM { SelectedClasses = new ClassRowCM[1] }; postedClasses.SelectedClasses[0] = new ClassRowCM { Index = 1, Level = 12, RemainingHitDice = 12, SelectedClass_id = Guid.Parse("4e82620a-0496-4ecc-b6d4-05faa064310b"), SelectedSubclass_id = Guid.Parse("c8d2e23a-a193-4e06-8814-9180d4830732") }; PrimaryTabVM primaryTab = new PrimaryTabVM { Name = "Caleb Widowgast", Alignment = "Chaotic Good", Background = "blah", isInspired = false, Exp = 0, Race = Guid.Parse("14f91515-0107-4c79-a3da-be3cf48d7a26"), Classes = postedClasses, Stats = new StatsCM { Strength = 10, Dexterity = 12, Constitution = 14, Intelligence = 20, Wisdom = 16, Charisma = 16 }, Combat = new CombatCM { MaxHP = 15, CurrentHP = 15, TempHP = 0, DeathSaveFails = 0, DeathSaveSuccesses = 0, ArmorClass = 14, MovementSpeed = 30 }, Skills = new ProficiencyCM { isProficient = new IsProficientCM { Acrobatics = false, AnimalHandling = false, Arcana = true, Athletics = false, Deception = true, History = true, Intimidation = false, Investigation = true, Medicine = false, Nature = false, Perception = false, Performance = false, Persuasion = false, Religion = true, SleightOfHand = false, Stealth = false, Survival = true } }, Saves = new SavesCM { StrengthSave = false, DexteritySave = false, ConstitutionSave = true, IntelligenceSave = true, WisdomSave = false, CharismaSave = false, } }; NoteTabVM noteTab = new NoteTabVM { Notes = new NoteCM[1] }; noteTab.Notes[0] = new NoteCM { Name = "The Cat Prince", Contents = "A children's picture book. The text is in Zemnian" }; InventoryTabVM inventoryTab = new InventoryTabVM { Money = new MoneyCM { GoldPieces = 3, SilverPieces = 50 }, Items = new HeldItemRowCM[1] }; inventoryTab.Items[0] = new HeldItemRowCM { Item_id = Guid.Parse("2caa23dc-15e6-4a57-9bb6-62f6d8636ff7"), isAttuned = false, isEquipped = false, Count = 1 }; SpellsTabVM spellsTab = new SpellsTabVM { KnownSpells = new KnownSpellRowCM[1] }; spellsTab.KnownSpells[0] = new KnownSpellRowCM { Spell_id = Guid.Parse("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"), isPrepared = true }; CharacterVM Argument = new CharacterVM { PrimaryTab = primaryTab, NotesTab = noteTab, InventoryTab = inventoryTab, SpellsTab = spellsTab }; return(Argument); }
public void CreateCharacter_GET_ReturnNonNullCharacterVM() { //Arrange PrimaryTabVM primaryTab = new PrimaryTabVM { Races = CreateTestData.GetRacesListModels(), Classes = CreateTestData.GetNonNullClassesCM(), Stats = new StatsCM { Bonus = new StatBonusCM() }, Saves = new SavesCM(), Combat = new CombatCM(), Skills = new ProficiencyCM { isProficient = new IsProficientCM(), TotalBonus = new SkillBonusCM() } }; NoteCM blankNote = new NoteCM(); NoteCM[] noteArray = new NoteCM[1]; noteArray[0] = blankNote; NoteTabVM notesTab = new NoteTabVM { Notes = noteArray }; InventoryTabVM inventory = new InventoryTabVM { Money = new MoneyCM(), Items = new HeldItemRowCM[0] }; SpellsTabVM spells = new SpellsTabVM { KnownSpells = new KnownSpellRowCM[0] }; CharacterVM expected = new CharacterVM { PrimaryTab = primaryTab, NotesTab = notesTab, InventoryTab = inventory, SpellsTab = spells }; using (var mocks = AutoMock.GetLoose()) { mocks.Mock <IBaseUserAccess>() .Setup(x => x.GetAllRaces()).Returns(CreateTestData.GetListOfRace()); mocks.Mock <IBaseUserAccess>() .Setup(x => x.GetAllPlayableClasses()).Returns(CreateTestData.GetPlayableClasses()); mocks.Mock <ICharacterCommonFunctions>() .Setup(x => x.itemExists(Guid.NewGuid())).Returns(false); var access = mocks.Create <IBaseUserAccess>(); var commons = mocks.Create <ICharacterCommonFunctions>(); //Act var toTest = ProcessorFactory.getCreateCharacterProcessor(access, commons); var actual = toTest.CreateCharacterGET(); //Assert actual.Should().BeEquivalentTo(expected); } }