public void Build_SingleNameAndBoolValue_ConnectionString() { var builder = ConnectionStringBuilder.New(); builder.With("name", true); Assert.That(builder.Build(), Is.EqualTo("name=True")); }
public void Build_SingleName_ConnectionString() { var builder = ConnectionStringBuilder.New(); builder.With("name", null); Assert.That(builder.Build(), Is.EqualTo("name")); }
public void With_ValueThatNeedsToBeEscaped_ConnectionString(string value) { var builder = ConnectionStringBuilder.New(); builder.With("name", value); Assert.That(builder.Build(), Is.EqualTo($"name='{value}'")); }
public void Build_MultipleNamesAndValues_ConnectionString() { var builder = ConnectionStringBuilder.New() .With("name1", "value1") .With("name2", "value2"); Assert.That(builder.Build(), Is.EqualTo("name1=value1;name2=value2")); }
public void Build_OverrideExistingNameAndValue_ConnectionString() { var builder = ConnectionStringBuilder.New() .With("name", "value") .With("Name", "VALUE"); Assert.That(builder.Build(), Is.EqualTo("name=VALUE")); }
public void With_ValueHasIllegalCharacters_Throws() { var builder = ConnectionStringBuilder.New(); Assert.Throws <ArgumentException>(() => builder.With("name", "value with illegal chars \r\n")); }
public void With_NameDoesNotStartWithLetter_Throws() { var builder = ConnectionStringBuilder.New(); Assert.Throws <ArgumentException>(() => builder.With("1name", "")); }