public static void FillCache(string xmlPath, ICacheRepository cacheRepository) { var parser = new XmlParser(xmlPath); var modules = parser.ParseXml(); var tableOfContents = new TableOfContents(modules); cacheRepository.Clear(); // By convention, the table of contents is always situated at Guid.Empty. cacheRepository.Put(CourseService.TableOfContentsKey, tableOfContents); foreach (var lesson in modules.SelectMany(x => x.Lessons)) cacheRepository.Put(lesson.Id, lesson); }
public void ThrowsFileNotFoundExceptionWhenFileDoesNotExist() { var parser = new XmlParser(@"Web\CourseData\XmlParserTests\DoesNotExist.xml"); }
public void ThrowsFileNotFoundExceptionWhenDirectoryDoesNotExist() { var parser = new XmlParser(@"Web\CourseData\DoesNotExist\DoesNotExist.xml"); }
public void LoadsCorrectlyWhenFileExists() { var parser = new XmlParser(@"Web\CourseData\XmlParserTests\Course.xml"); }