Ejemplo n.º 1
0
        public void ShouldNotGetStacksAndLogError()
        {
            MockedDatabase <Stack> database;
            StackModule            module;
            MemoryLogger           logger;


            logger   = new MemoryLogger();
            database = new MockedDatabase <Stack>(true, 3, (t) => new Stack()
            {
                StackID = t
            });
            module = new StackModule(logger, database);
            Assert.ThrowsException <PIODataException>(() => module.GetStacks(1));
            Assert.IsNotNull(logger.Logs.FirstOrDefault(item => (item.Level == LogLevels.Error) && (item.ComponentName == module.ModuleName)));
        }
Ejemplo n.º 2
0
        public void ShouldGetStacks()
        {
            MockedDatabase <Stack> database;
            StackModule            module;

            Stack[] results;

            database = new MockedDatabase <Stack>(false, 3, (t) => new Stack()
            {
                StackID = t
            });
            module  = new StackModule(NullLogger.Instance, database);
            results = module.GetStacks(1);
            Assert.IsNotNull(results);
            Assert.AreEqual(3, results.Length);
            for (int t = 0; t < 3; t++)
            {
                Assert.IsNotNull(results[t]);
                Assert.AreEqual(t, results[t].StackID);
            }
        }