public void Load_PlayerDataOnly_DataLoadedCorrectly() { // Act XmlGameDataReader xmlGameDataReader; using (var stream = this.GetXmlStream()) { xmlGameDataReader = new XmlGameDataReader(stream); } // Assert xmlGameDataReader.ShouldNotBeNull(); xmlGameDataReader[GameDataSectionKeys.PlayerOne].GetIdentityValue(GameDataValueKeys.PlayerId).ShouldBe(this.firstId); xmlGameDataReader[GameDataSectionKeys.PlayerOne].GetStringValue(GameDataValueKeys.PlayerName).ShouldBe(this.firstName); xmlGameDataReader[GameDataSectionKeys.PlayerOne].GetIntegerValue(GameDataValueKeys.PlayerBrick).ShouldBe(this.firstBrickCount); xmlGameDataReader[GameDataSectionKeys.PlayerOne].GetIntegerValue(GameDataValueKeys.PlayerGrain).ShouldBe(this.firstGrainCount); xmlGameDataReader[GameDataSectionKeys.PlayerOne].GetIntegerValue(GameDataValueKeys.PlayerLumber).ShouldBe(this.firstLumberCount); xmlGameDataReader[GameDataSectionKeys.PlayerOne].GetIntegerValue(GameDataValueKeys.PlayerOre).ShouldBe(this.firstOreCount); xmlGameDataReader[GameDataSectionKeys.PlayerOne].GetIntegerValue(GameDataValueKeys.PlayerWool).ShouldBe(this.firstWoolCount); xmlGameDataReader[GameDataSectionKeys.PlayerTwo].GetIdentityValue(GameDataValueKeys.PlayerId).ShouldBe(this.secondId); xmlGameDataReader[GameDataSectionKeys.PlayerTwo].GetStringValue(GameDataValueKeys.PlayerName).ShouldBe(this.secondName); xmlGameDataReader[GameDataSectionKeys.PlayerTwo].GetIntegerValue(GameDataValueKeys.PlayerBrick).ShouldBe(this.secondBrickCount); xmlGameDataReader[GameDataSectionKeys.PlayerTwo].GetIntegerValue(GameDataValueKeys.PlayerGrain).ShouldBe(this.secondGrainCount); xmlGameDataReader[GameDataSectionKeys.PlayerTwo].GetIntegerValue(GameDataValueKeys.PlayerLumber).ShouldBe(this.secondLumberCount); xmlGameDataReader[GameDataSectionKeys.PlayerTwo].GetIntegerValue(GameDataValueKeys.PlayerOre).ShouldBe(this.secondOreCount); xmlGameDataReader[GameDataSectionKeys.PlayerTwo].GetIntegerValue(GameDataValueKeys.PlayerWool).ShouldBe(this.secondWoolCount); xmlGameDataReader[GameDataSectionKeys.PlayerThree].GetIdentityValue(GameDataValueKeys.PlayerId).ShouldBe(this.thirdId); xmlGameDataReader[GameDataSectionKeys.PlayerThree].GetStringValue(GameDataValueKeys.PlayerName).ShouldBe(this.thirdName); xmlGameDataReader[GameDataSectionKeys.PlayerThree].GetIntegerValue(GameDataValueKeys.PlayerBrick).ShouldBe(this.thirdBrickCount); xmlGameDataReader[GameDataSectionKeys.PlayerThree].GetIntegerValue(GameDataValueKeys.PlayerGrain).ShouldBe(this.thirdGrainCount); xmlGameDataReader[GameDataSectionKeys.PlayerThree].GetIntegerValue(GameDataValueKeys.PlayerLumber).ShouldBe(this.thirdLumberCount); xmlGameDataReader[GameDataSectionKeys.PlayerThree].GetIntegerValue(GameDataValueKeys.PlayerOre).ShouldBe(this.thirdOreCount); xmlGameDataReader[GameDataSectionKeys.PlayerThree].GetIntegerValue(GameDataValueKeys.PlayerWool).ShouldBe(this.thirdWoolCount); xmlGameDataReader[GameDataSectionKeys.PlayerFour].GetIdentityValue(GameDataValueKeys.PlayerId).ShouldBe(this.fourthId); xmlGameDataReader[GameDataSectionKeys.PlayerFour].GetStringValue(GameDataValueKeys.PlayerName).ShouldBe(this.fourthName); xmlGameDataReader[GameDataSectionKeys.PlayerFour].GetIntegerValue(GameDataValueKeys.PlayerBrick).ShouldBe(this.fourthBrickCount); xmlGameDataReader[GameDataSectionKeys.PlayerFour].GetIntegerValue(GameDataValueKeys.PlayerGrain).ShouldBe(this.fourthGrainCount); xmlGameDataReader[GameDataSectionKeys.PlayerFour].GetIntegerValue(GameDataValueKeys.PlayerLumber).ShouldBe(this.fourthLumberCount); xmlGameDataReader[GameDataSectionKeys.PlayerFour].GetIntegerValue(GameDataValueKeys.PlayerOre).ShouldBe(this.fourthOreCount); xmlGameDataReader[GameDataSectionKeys.PlayerFour].GetIntegerValue(GameDataValueKeys.PlayerWool).ShouldBe(this.fourthWoolCount); }
public void Load_HexDataOnly_DataLoadedCorrectly() { // Act XmlGameDataReader xmlGameDataReader; using (var stream = this.GetXmlStream()) { xmlGameDataReader = new XmlGameDataReader(stream); } // Assert xmlGameDataReader.ShouldNotBeNull(); xmlGameDataReader[GameDataSectionKeys.GameBoard] .GetStringValue(GameDataValueKeys.HexResources) .ShouldBe("glbglogob gwwwlwlbo"); xmlGameDataReader[GameDataSectionKeys.GameBoard] .GetIntegerArrayValue(GameDataValueKeys.HexProduction) .ShouldContainExact(new[] { 9, 8, 5, 12, 11, 3, 6, 10, 6, 0, 4, 11, 2, 4, 3, 5, 9, 10, 8 }); }
public void Load_PlayerAndInfrastructureData_GameBoardIsAsExpected() { // Act XmlGameDataReader xmlGameDataReader; using (var stream = this.GetXmlStream()) { xmlGameDataReader = new XmlGameDataReader(stream); } // Assert xmlGameDataReader.ShouldNotBeNull(); var settlementData = xmlGameDataReader.GetSections(GameDataSectionKeys.Buildings); settlementData.Length.ShouldBe(4); settlementData[0].GetIdentityValue(GameDataValueKeys.SettlementOwner).ShouldBe(this.firstId); settlementData[0].GetIntegerValue(GameDataValueKeys.SettlementLocation).ShouldBe(this.firstLocation); settlementData[1].GetIdentityValue(GameDataValueKeys.SettlementOwner).ShouldBe(this.secondId); settlementData[1].GetIntegerValue(GameDataValueKeys.SettlementLocation).ShouldBe(this.secondLocation); settlementData[2].GetIdentityValue(GameDataValueKeys.SettlementOwner).ShouldBe(this.thirdId); settlementData[2].GetIntegerValue(GameDataValueKeys.SettlementLocation).ShouldBe(this.thirdLocation); settlementData[3].GetIdentityValue(GameDataValueKeys.SettlementOwner).ShouldBe(this.fourthId); settlementData[3].GetIntegerValue(GameDataValueKeys.SettlementLocation).ShouldBe(this.fourthLocation); var roadData = xmlGameDataReader.GetSections(GameDataSectionKeys.Roads); roadData.Length.ShouldBe(4); roadData[0].GetIdentityValue(GameDataValueKeys.RoadOwner).ShouldBe(this.firstId); roadData[0].GetIntegerValue(GameDataValueKeys.RoadStart).ShouldBe(this.firstStart); roadData[0].GetIntegerValue(GameDataValueKeys.RoadEnd).ShouldBe(this.firstEnd); roadData[1].GetIdentityValue(GameDataValueKeys.RoadOwner).ShouldBe(this.secondId); roadData[1].GetIntegerValue(GameDataValueKeys.RoadStart).ShouldBe(this.secondStart); roadData[1].GetIntegerValue(GameDataValueKeys.RoadEnd).ShouldBe(this.secondEnd); roadData[2].GetIdentityValue(GameDataValueKeys.RoadOwner).ShouldBe(this.thirdId); roadData[2].GetIntegerValue(GameDataValueKeys.RoadStart).ShouldBe(this.thirdStart); roadData[2].GetIntegerValue(GameDataValueKeys.RoadEnd).ShouldBe(this.thirdEnd); roadData[3].GetIdentityValue(GameDataValueKeys.RoadOwner).ShouldBe(this.fourthId); roadData[3].GetIntegerValue(GameDataValueKeys.RoadStart).ShouldBe(this.fourthStart); roadData[3].GetIntegerValue(GameDataValueKeys.RoadEnd).ShouldBe(this.fourthEnd); }