public void TestNonGenricEnumerator() { TextLoggingService service = GetLogsService(); ClearTestLogDirectory(service); Tuple <Foobar, BarredFoo> objects = CreateObjects(); service.LogMessage("Logging object 1", objects.Item1, LogLevel.Debug, "Foobar log"); service.LogMessage("Logging object 2", objects.Item2, LogLevel.Debug, "BarredFoo log"); ILogBaseEnumerable collection = service.GetLogs(); LogBase[] logs = collection.ToArray(); int index = 0; foreach (LogBase log in ((IEnumerable)collection)) { Assert.Equal(log, logs[index]); index++; } int collectionCount = collection.Count(); Assert.Equal(2, collectionCount); index = 0; foreach (LogBase log in ((IEnumerable)collection)) { Assert.Equal(log, logs[index]); index++; } ClearTestLogDirectory(service); }
public void TestBasicEnumeration() { CacheLoggingService service = GetLogsService(); Tuple <Foobar, BarredFoo> objects = CreateObjects(); service.LogMessage("Logging object 1", objects.Item1, LogLevel.Debug, "Foobar log"); service.LogMessage("Logging object 2", objects.Item2, LogLevel.Debug, "BarredFoo log"); ILogBaseEnumerable collection = service.GetLogs(); Assert.NotEmpty(collection); foreach (LogBase log in collection) { Assert.NotNull(log); } int collectionCount = collection.Count(); Assert.Equal(2, collectionCount); }