public void GetValidElementNameTrimsWhitespaceAndPrependsXIfInvalidBegin() { // Arrange var sut = new XmlPropertyFormatter(); // Act + assert var result = sut.GetValidElementName(" xmlName "); Assert.Equal("xxmlName", result); // Act + assert var result2 = sut.GetValidElementName(" 4Name "); Assert.Equal("x4Name", result2); }
public void GetValidElementNamePrependsXIfXmlAtBeginCaseInsensitive() { // Arrange var sut = new XmlPropertyFormatter(); // Act + assert var result = sut.GetValidElementName("xmlName"); Assert.Equal("xxmlName", result); // Act + assert var result2 = sut.GetValidElementName("XmlName"); Assert.Equal("xXmlName", result2); }
public void GetValidElementNameReplacesEnclosedWhitespaceWithUnderscore() { // Arrange var sut = new XmlPropertyFormatter(); // Act var result = sut.GetValidElementName("Name\tWith Space"); // Assert Assert.Equal("Name_With___Space", result); }
public void GetValidElementNamePrependsXIfNonLetterAtBegin() { // Arrange var sut = new XmlPropertyFormatter(); // Act var result = sut.GetValidElementName("$Name"); // Assert Assert.Equal("x$Name", result); }
public void GetValidElementNameTrimsWhitespace() { // Arrange var sut = new XmlPropertyFormatter(); // Act var result = sut.GetValidElementName(" \tname \t"); // Assert Assert.Equal("name", result); }
public void GetValidElementNameReturnsValidNameOnEmpty() { // Arrange var sut = new XmlPropertyFormatter(); // Act var result = sut.GetValidElementName(string.Empty); // Assert Assert.Equal("x", result); }