コード例 #1
0
        public void ShouldFindStack()
        {
            MockedDatabase <Stack> database;
            StackModule            module;
            Stack result;

            database = new MockedDatabase <Stack>(false, 1, (t) => new Stack()
            {
                StackID = t
            });
            module = new StackModule(NullLogger.Instance, database);
            result = module.FindStack(1, ResourceTypeIDs.Coal);
            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.StackID);
        }
コード例 #2
0
        public void ShouldNotFindStackAndLogError()
        {
            MockedDatabase <Stack> database;
            StackModule            module;
            MemoryLogger           logger;


            logger   = new MemoryLogger();
            database = new MockedDatabase <Stack>(true, 1, (t) => new Stack()
            {
                StackID = t
            });
            module = new StackModule(logger, database);
            Assert.ThrowsException <PIODataException>(() => module.FindStack(1, ResourceTypeIDs.Coal));
            Assert.IsNotNull(logger.Logs.FirstOrDefault(item => (item.Level == LogLevels.Error) && (item.ComponentName == module.ModuleName)));
        }