public void LoadContentFromLocalFile_CorrectPath_DesiredPageReturned() { var input = "SimplePage.html"; var expectation = File.ReadAllText(@"Resources/SimplePage.html"); var result = _pageLoader.LoadContentFromLocalFile(input); Assert.IsNotNull(result); Assert.AreEqual(expectation, result); }
public void LoadContentFromLocalFile_ExceptionOccurs_500PageReturned() { var localConfigurationHelperMock = new Mock <IConfigurationHelper>(); localConfigurationHelperMock.Setup(x => x.GetFilesPath()).Throws(new Exception("Test exception")); var localPageLoader = new SimplePageLoader(localConfigurationHelperMock.Object); var input = string.Empty; var expectation = DefaultPages.Error500; var result = localPageLoader.LoadContentFromLocalFile(input); Assert.IsNotNull(result); Assert.AreEqual(expectation, result); }
public void LoadContentFromLocalFile_EmptyPathIndexNotAvailable_404PageReturned() { var localConfigurationHelperMock = new Mock <IConfigurationHelper>(); localConfigurationHelperMock.Setup(x => x.GetFilesPath()) .Returns(Path.Combine(Environment.CurrentDirectory, @"Resources/Empty")); var localPageLoader = new SimplePageLoader(localConfigurationHelperMock.Object); var input = string.Empty; var expectation = DefaultPages.Error404; var result = localPageLoader.LoadContentFromLocalFile(input); Assert.IsNotNull(result); Assert.AreEqual(expectation, result); }