Assert.AreEqual(false,builder.TrustServerCertificate,"#1 The default value should be false");
builder.TrustServerCertificate=true;
Assert.AreEqual(true,builder.TrustServerCertificate,"#2 The value returned should be true after setting the value of TrustServerCertificate to true");
Assert.AreEqual("TrustServerCertificate=True",builder.ConnectionString,"#3 The value of the key TrustServerCertificate should be added to the connection string");
}
[Test]
publicvoidTypeSystemVersionTest()
{
builder=newSqlConnectionStringBuilder();
Assert.AreEqual("Latest",builder.TypeSystemVersion,"#1 The default value for the property should be Latest");
builder.TypeSystemVersion="SQL Server 2005";
Assert.AreEqual("SQL Server 2005",builder.TypeSystemVersion,"#2 The value for the property should be SQL Server 2005 after setting this value");
Assert.AreEqual("Type System Version=\"SQL Server 2005\"",builder.ConnectionString,"#3 The value of the key Type System Version should be added to the connection string");
}
[Test]
publicvoidUserInstanceTest()
{
builder=newSqlConnectionStringBuilder();
Assert.AreEqual(false,builder.UserInstance,"#1 The default value for the property should be false");
builder.UserInstance=true;
Assert.AreEqual(true,builder.UserInstance,"#2 The value for the property should be true after setting its value to true");
Assert.AreEqual("User Instance=True",builder.ConnectionString,"#3 The value of the key User Instance should be added to the connection string");
}
[Test]
publicvoidSettingUserInstanceTest()
{
builder=newSqlConnectionStringBuilder();
builder["User Instance"]=true;
Assert.AreEqual("User Instance=True",builder.ConnectionString,"#1 The value of the key User Instance should be added to the connection string");
Assert.AreEqual(false,builder.ContextConnection,"#1 The default value for the property should be false");
builder.ContextConnection=true;
Assert.AreEqual(true,builder.ContextConnection,"#2 The value for the property should be true after setting its value to true");
Assert.AreEqual("Context Connection=True",builder.ConnectionString,"#3 The value of the key Context Connection should be added to the connection string");
Assert.AreEqual("Context Connection=True",builder.ConnectionString,"#1 The value of the key Context Connection should be added to the connection string");