public void ExceptionIsThrownOnUnparseableLine() { const string ck3Path = "TestFiles/corruptedCK3"; // this definition.csv has a line with quoted province id Assert.Throws <FormatException>(() => _ = new ProvinceDefinitions(ck3Path)); }
public void DictionariesDefaultToEmpty() { var provDefs = new ProvinceDefinitions(testCK3Path); Assert.Collection(provDefs.ColorToProvinceDict, pair1 => { (Rgb24 key, ulong value) = pair1; Assert.Equal(new Rgb24(42, 3, 128), key); Assert.Equal((ulong)1, value); }, pair2 => { (Rgb24 key, ulong value) = pair2; Assert.Equal(new Rgb24(84, 6, 1), key); Assert.Equal((ulong)2, value); }, pair3 => { (Rgb24 key, ulong value) = pair3; Assert.Equal(new Rgb24(126, 9, 129), key); Assert.Equal((ulong)3, value); } ); Assert.Collection(provDefs.ProvinceToColorDict, pair1 => { (ulong key, Rgb24 value) = pair1; Assert.Equal((ulong)1, key); Assert.Equal(new Rgb24(42, 3, 128), value); }, pair2 => { (ulong key, Rgb24 value) = pair2; Assert.Equal((ulong)2, key); Assert.Equal(new Rgb24(84, 6, 1), value); }, pair3 => { (ulong key, Rgb24 value) = pair3; Assert.Equal((ulong)3, key); Assert.Equal(new Rgb24(126, 9, 129), value); } ); }