public void TestBadArguments() { var zones = new IZone[] { null, null, null, null, null, null, null, null, null }; var mapping = new int[] { 3, 2, 1, 3, 2, 1, 3, 2, 1 }; ExpectNullArgumentException(() => { ZoneMap.CreateZoneMap(null, null); }); ExpectNullArgumentException(() => { ZoneMap.CreateZoneMap(zones, null); }); ExpectNullArgumentException(() => { ZoneMap.CreateZoneMap(null, mapping); }); }
public void CreateValidMap() { // 3,2,1 three times var zones = new IZone[] { null, null, null, null, null, null, null, null, null }; var mapping = new int[] { 3, 2, 1, 3, 2, 1, 3, 2, 1 }; var map = ZoneMap.CreateZoneMap(zones, mapping); Assert.IsNotNull(map); for (int i = 0; i < mapping.Length; i++) { Assert.AreEqual(mapping[i], map.Map[i]); } Assert.AreEqual(3, map.MapValues.Count); foreach (var mapKey in map.MapValues) { var containedZoneIndexes = map.KeyToZoneIndex[mapKey]; for (int i = 0; i < containedZoneIndexes.Count; i++) { Assert.AreEqual(mapping[containedZoneIndexes[i]], mapKey); } } }