public void ShouldNotGetCellUsingCoordinates() { MockedDatabase <Cell> database; CellModule module; Cell result; database = new MockedDatabase <Cell>(false, 0, (t) => new Cell() { CellID = t, X = 3, Y = 4 }); module = new CellModule(NullLogger.Instance, database); result = module.GetCell(1, 4, 3); Assert.IsNull(result); }
public void ShouldGetCell() { MockedDatabase <Cell> database; CellModule module; Cell result; database = new MockedDatabase <Cell>(false, 1, (t) => new Cell() { CellID = t }); module = new CellModule(NullLogger.Instance, database); result = module.GetCell(1); Assert.IsNotNull(result); Assert.AreEqual(0, result.CellID); }
public void ShouldNotGetCellUsingCoordinateAndLogError() { MockedDatabase <Cell> database; CellModule module; MemoryLogger logger; logger = new MemoryLogger(); database = new MockedDatabase <Cell>(true, 1, (t) => new Cell() { CellID = t }); module = new CellModule(logger, database); Assert.ThrowsException <PIODataException>(() => module.GetCell(1, 3, 4)); Assert.IsNotNull(logger.Logs.FirstOrDefault(item => (item.Level == LogLevels.Error) && (item.ComponentName == module.ModuleName))); }
public void ShouldGetCellUsingCoordinates() { MockedDatabase <Cell> database; CellModule module; Cell result; database = new MockedDatabase <Cell>(false, 1, (t) => new Cell() { CellID = t, X = 3, Y = 4 }); module = new CellModule(NullLogger.Instance, database); result = module.GetCell(1, 3, 4); Assert.IsNotNull(result); Assert.AreEqual(0, result.CellID); Assert.AreEqual(3, result.X); Assert.AreEqual(4, result.Y); }