示例#1
0
        public void ShouldGetPhrase()
        {
            MockedDatabase <Phrase> database;
            PhraseModule            module;
            Phrase result;

            database = new MockedDatabase <Phrase>(false, 1, (t) => new Phrase()
            {
                Key = t.ToString(), CountryCode = "EN"
            });
            module = new PhraseModule(NullLogger.Instance, database);
            result = module.GetPhrase("1", "EN");
            Assert.IsNotNull(result);
            Assert.AreEqual("0", result.Key);
        }
示例#2
0
        public void ShouldNotGetPhraseAndLogError()
        {
            MockedDatabase <Phrase> database;
            PhraseModule            module;
            MemoryLogger            logger;


            logger   = new MemoryLogger();
            database = new MockedDatabase <Phrase>(true, 1, (t) => new Phrase()
            {
                Key = t.ToString(), CountryCode = "EN"
            });
            module = new PhraseModule(logger, database);
            Assert.ThrowsException <PIODataException>(() => module.GetPhrase("1", "EN"));
            Assert.IsNotNull(logger.Logs.FirstOrDefault(item => (item.Level == LogLevels.Error) && (item.ComponentName == module.ModuleName)));
        }