コード例 #1
0
ファイル: BuildingModuleUnitTest.cs プロジェクト: dfgs/PIO
        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);
        }
コード例 #2
0
ファイル: BuildingModuleUnitTest.cs プロジェクト: dfgs/PIO
        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)));
        }