コード例 #1
0
            public void ShouldThrowWhenKeyWasNotFound()
            {
                // Arrange
                var section = Substitute.For <IConfigurationSection>();
                var sut     = new SectionBaseWrapper(section);

                // Act
                var ex = Record.Exception(() => sut.ReadStringWrapper("non.existing"));

                // Assert
                Assert.IsType <KeyNotFoundException>(ex);
            }
コード例 #2
0
            public void ShouldReadValueFromSection()
            {
                // Arrange
                const string expected = "value";
                const string key      = "key";

                var section = Substitute.For <IConfigurationSection>();

                section[key].Returns(expected);
                var sut = new SectionBaseWrapper(section);

                // Act
                var actual = sut.ReadStringWrapper(key);

                // Assert
                Assert.Equal(expected, actual);
            }