public void ShouldNotGetPhrasesAndLogError() { MockedDatabase <Phrase> database; PhraseModule module; MemoryLogger logger; logger = new MemoryLogger(); database = new MockedDatabase <Phrase>(true, 3, (t) => new Phrase() { Key = t.ToString(), CountryCode = "EN" }); module = new PhraseModule(logger, database); Assert.ThrowsException <PIODataException>(() => module.GetPhrases("EN")); Assert.IsNotNull(logger.Logs.FirstOrDefault(item => (item.Level == LogLevels.Error) && (item.ComponentName == module.ModuleName))); }
public void ShouldGetPhrases() { MockedDatabase <Phrase> database; PhraseModule module; Phrase[] results; database = new MockedDatabase <Phrase>(false, 3, (t) => new Phrase() { Key = t.ToString(), CountryCode = "EN" }); module = new PhraseModule(NullLogger.Instance, database); results = module.GetPhrases("EN"); Assert.IsNotNull(results); Assert.AreEqual(3, results.Length); for (int t = 0; t < 3; t++) { Assert.IsNotNull(results[t]); Assert.AreEqual(t.ToString(), results[t].Key); } }