Ejemplo n.º 1
0
        public void ShouldUpdateBuilding()
        {
            MockedDatabase <Building> database;
            BuildingModule            module;

            database = new MockedDatabase <Building>(false, 1, (t) => new Building()
            {
                BuildingID = t
            });
            module = new BuildingModule(NullLogger.Instance, database);
            module.UpdateBuilding(0, 10);
            Assert.AreEqual(1, database.UpdatedCount);
        }
Ejemplo n.º 2
0
        public void ShouldNotUpdateBuildingAndLogError()
        {
            MockedDatabase <Building> database;
            BuildingModule            module;
            MemoryLogger logger;

            logger   = new MemoryLogger();
            database = new MockedDatabase <Building>(true, 3, (t) => new Building()
            {
                BuildingID = t
            });
            module = new BuildingModule(logger, database);
            Assert.ThrowsException <PIODataException>(() => module.UpdateBuilding(0, 1));
            Assert.IsNotNull(logger.Logs.FirstOrDefault(item => (item.Level == LogLevels.Error) && (item.ComponentName == module.ModuleName)));
        }