예제 #1
0
        public void Parsing_empty_and_null_strings_yield_null()
        {
            string nullString = null;

            Assert.That(ConnectionDefinition.Parse(nullString), Is.Null);
            Assert.That(ConnectionDefinition.Parse(""), Is.Null);
        }
예제 #2
0
        public void Can_parse_an_array_of_connection_definitions()
        {
            string[] lines = new string[]
            {
                "Connection1^sql^Server=.; Database=master; Integrated Security=SSPI",
                "Connection2^oracle^Server=.; Database=fred; user=bob; password=p"
            };

            ConnectionDefinition[] connDefs = ConnectionDefinition.Parse(lines);

            Assert.That(connDefs.Length, Is.EqualTo(2));
            Assert.That(connDefs[0].Name, Is.EqualTo("Connection1"));
            Assert.That(connDefs[1].Name, Is.EqualTo("Connection2"));
        }
예제 #3
0
        public void Calling_ToParsableFormat_creates_a_parsable_string()
        {
            connDef.Name             = "the name";
            connDef.ProviderName     = "the provider";
            connDef.ConnectionString = "the connection string";

            string connDefStr = connDef.ToParsableFormat();

            Assert.That(connDefStr, Is.EqualTo("the name^the provider^the connection string"));

            ConnectionDefinition newConnDef = ConnectionDefinition.Parse(connDefStr);

            Assert.That(connDef.Name, Is.EqualTo("the name"));
            Assert.That(connDef.ProviderName, Is.EqualTo("the provider"));
            Assert.That(connDef.ConnectionString, Is.EqualTo("the connection string"));
        }
예제 #4
0
        public void Parsing_a_hashed_connection_string_yields_null()
        {
            ConnectionDefinition connDef = ConnectionDefinition.Parse("#" + sampleConnectionDefinition);

            Assert.That(connDef, Is.Null);
        }
예제 #5
0
 public void TestSetUp()
 {
     connDef = ConnectionDefinition.Parse(sampleConnectionDefinition);
 }