Пример #1
0
        public void Setup()
        {
            _configurationHelperMock = new Mock <IConfigurationHelper>();
            _configurationHelperMock.Setup(x => x.GetFilesPath())
            .Returns(Path.Combine(Environment.CurrentDirectory, @"Resources"));

            _pageLoader = new SimplePageLoader(_configurationHelperMock.Object);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }