public void ShouldNotGetBuildingUsingCoordinates() { MockedDatabase <Building> database; BuildingModule module; Building result; database = new MockedDatabase <Building>(false, 0, (t) => new Building() { BuildingID = t, X = 3, Y = 4 }); module = new BuildingModule(NullLogger.Instance, database); result = module.GetBuilding(1, 4, 3); Assert.IsNull(result); }
public void ShouldGetBuilding() { MockedDatabase <Building> database; BuildingModule module; Building result; database = new MockedDatabase <Building>(false, 1, (t) => new Building() { BuildingID = t }); module = new BuildingModule(NullLogger.Instance, database); result = module.GetBuilding(1); Assert.IsNotNull(result); Assert.AreEqual(0, result.BuildingID); }
public void ShouldNotGetBuildingUsingCoordinateAndLogError() { MockedDatabase <Building> database; BuildingModule module; MemoryLogger logger; logger = new MemoryLogger(); database = new MockedDatabase <Building>(true, 1, (t) => new Building() { BuildingID = t }); module = new BuildingModule(logger, database); Assert.ThrowsException <PIODataException>(() => module.GetBuilding(1, 3, 4)); Assert.IsNotNull(logger.Logs.FirstOrDefault(item => (item.Level == LogLevels.Error) && (item.ComponentName == module.ModuleName))); }
public void ShouldGetBuildingUsingCoordinates() { MockedDatabase <Building> database; BuildingModule module; Building result; database = new MockedDatabase <Building>(false, 1, (t) => new Building() { BuildingID = t, X = 3, Y = 4 }); module = new BuildingModule(NullLogger.Instance, database); result = module.GetBuilding(1, 3, 4); Assert.IsNotNull(result); Assert.AreEqual(0, result.BuildingID); Assert.AreEqual(3, result.X); Assert.AreEqual(4, result.Y); }