public void WithProperty_PropertyNameAndStringIndex_OriginalSectionNameIsNotChanged() { // Arrange var sectionName = new SectionName("somePath"); // Act sectionName.WithProperty("someProperty", "20"); // Assert Assert.Equal("somePath", sectionName.PropertyPath); }
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); }
public void WithProperty_PropertyNameSet_MergesBasePathWithPropertyName() { // Arrange var sectionName = new SectionName("somePath"); // Act var newSectionName = sectionName.WithProperty("someProperty"); // Assert Assert.Equal("somePath.someProperty", newSectionName.PropertyPath); }
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); }
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); }