Ejemplo n.º 1
0
 public void ParseConnectionStringIntoFormatExceptionTest(string connectionString)
 {
     Assert.Throws <FormatException>(() =>
     {
         ModifiableBobConnectionParametersMock target = new ModifiableBobConnectionParametersMock();
         BobConnectionStringParser.ParseConnectionStringInto(connectionString, target);
     });
 }
Ejemplo n.º 2
0
        public void ParseConnectionStringIntoTest(string connectionString, ModifiableBobConnectionParametersMock expected)
        {
            ModifiableBobConnectionParametersMock target = new ModifiableBobConnectionParametersMock();

            BobConnectionStringParser.ParseConnectionStringInto(connectionString, target);

            Assert.Equal(expected, target);
        }
Ejemplo n.º 3
0
        public void ParseToStringRoundtripTest(string connectionString, ModifiableBobConnectionParametersMock data)
        {
            Assert.NotNull(connectionString);

            var stringRep = data.ToString(includePassword: true);
            var parsed    = new ModifiableBobConnectionParametersMock();

            BobConnectionStringParser.ParseConnectionStringInto(stringRep, parsed);
            Assert.Equal(data, parsed);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// <see cref="BobConnectionParametersBuilder"/> constructor from connection string
        /// </summary>
        /// <param name="connectionString">Connection string</param>
        public BobConnectionParametersBuilder(string connectionString)
        {
            if (connectionString == null)
            {
                throw new ArgumentNullException(nameof(connectionString));
            }

            _customParameters = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
            Host = string.Empty;

            BobConnectionStringParser.ParseConnectionStringInto(connectionString, this);
        }