Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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)));
        }
Exemplo n.º 4
0
        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);
        }