public void FileProvider_ReturnsCompositeFileProviderIfNoInstancesAreRegistered()
        {
            // Arrange
            var options = new RazorViewEngineOptions();
            var optionsAccessor = new Mock<IOptions<RazorViewEngineOptions>>();
            optionsAccessor.SetupGet(o => o.Value).Returns(options);
            var fileProviderAccessor = new DefaultRazorViewEngineFileProviderAccessor(optionsAccessor.Object);

            // Act
            var actual = fileProviderAccessor.FileProvider;

            // Assert
            Assert.IsType<CompositeFileProvider>(actual);
        }
示例#2
0
        public void FileProvider_ReturnsCompositeFileProviderIfNoInstancesAreRegistered()
        {
            // Arrange
            var options         = new RazorViewEngineOptions();
            var optionsAccessor = new Mock <IOptions <RazorViewEngineOptions> >();

            optionsAccessor.SetupGet(o => o.Value).Returns(options);
            var fileProviderAccessor = new DefaultRazorViewEngineFileProviderAccessor(optionsAccessor.Object);

            // Act
            var actual = fileProviderAccessor.FileProvider;

            // Assert
            Assert.IsType <CompositeFileProvider>(actual);
        }
        public void FileProvider_ReturnsInstanceIfExactlyOneFileProviderIsSpecified()
        {
            // Arrange
            var fileProvider = new TestFileProvider();
            var options = new RazorViewEngineOptions();
            options.FileProviders.Add(fileProvider);
            var optionsAccessor = new Mock<IOptions<RazorViewEngineOptions>>();
            optionsAccessor.SetupGet(o => o.Value).Returns(options);
            var fileProviderAccessor = new DefaultRazorViewEngineFileProviderAccessor(optionsAccessor.Object);

            // Act
            var actual = fileProviderAccessor.FileProvider;

            // Assert
            Assert.Same(fileProvider, actual);
        }
示例#4
0
        public void FileProvider_ReturnsInstanceIfExactlyOneFileProviderIsSpecified()
        {
            // Arrange
            var fileProvider = new TestFileProvider();
            var options      = new RazorViewEngineOptions();

            options.FileProviders.Add(fileProvider);
            var optionsAccessor = new Mock <IOptions <RazorViewEngineOptions> >();

            optionsAccessor.SetupGet(o => o.Value).Returns(options);
            var fileProviderAccessor = new DefaultRazorViewEngineFileProviderAccessor(optionsAccessor.Object);

            // Act
            var actual = fileProviderAccessor.FileProvider;

            // Assert
            Assert.Same(fileProvider, actual);
        }