Example #1
0
        public void WithProperty_PropertyNameAndStringIndex_OriginalSectionNameIsNotChanged()
        {
            // Arrange
            var sectionName = new SectionName("somePath");

            // Act
            sectionName.WithProperty("someProperty", "20");

            // Assert
            Assert.Equal("somePath", sectionName.PropertyPath);
        }
Example #2
0
        public void WithProperty_PropertyNameAndIntegerIndex_MergesBasePathWithPropertyNameAndIndex()
        {
            // Arrange
            var sectionName = new SectionName("somePath");

            // Act
            var newSectionName = sectionName.WithProperty("someProperty", 20);

            // Assert
            Assert.Equal("somePath.someProperty[20]", newSectionName.PropertyPath);
        }
Example #3
0
        public void WithProperty_PropertyNameSet_MergesBasePathWithPropertyName()
        {
            // Arrange
            var sectionName = new SectionName("somePath");

            // Act
            var newSectionName = sectionName.WithProperty("someProperty");

            // Assert
            Assert.Equal("somePath.someProperty", newSectionName.PropertyPath);
        }
Example #4
0
        public void ToString_PropertyNameAndStringIndex_ReturnsFullPath()
        {
            // Arrange
            var sectionName    = new SectionName("somePath");
            var newSectionName = sectionName.WithProperty("someProperty", "20");

            // Act
            var toString = newSectionName.ToString();

            // Assert
            Assert.Equal("somePath.someProperty[20]", toString);
        }
Example #5
0
        public void WithProperty_NullPropertyName_ThrowsException()
        {
            // Arrange
            var sectionName = new SectionName("somePath");

            // Act
            var exception = Assert.Throws <ArgumentNullException>(() =>
            {
                sectionName.WithProperty(null);
            });

            // Assert
            Assert.Equal("Value cannot be null. (Parameter 'propertyName')", exception.Message);
        }