public void Setup() { _configurationHelperMock = new Mock <IConfigurationHelper>(); _configurationHelperMock.Setup(x => x.GetFilesPath()) .Returns(Path.Combine(Environment.CurrentDirectory, @"Resources")); _pageLoader = new SimplePageLoader(_configurationHelperMock.Object); }
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); }