Ejemplo n.º 1
0
        public void TestSqlConnectionStringBuilderEquivilantTo_AttestationProtocol()
        {
            SqlConnectionAttestationProtocol protocol1 = SqlConnectionAttestationProtocol.AAS;
            SqlConnectionAttestationProtocol protocol2 = SqlConnectionAttestationProtocol.HGS;
            SqlConnectionAttestationProtocol protocol3 = SqlConnectionAttestationProtocol.None;

            SqlConnectionStringBuilder connectionStringBuilder1 = new SqlConnectionStringBuilder();
            SqlConnectionStringBuilder connectionStringBuilder2 = new SqlConnectionStringBuilder();
            SqlConnectionStringBuilder connectionStringBuilder3 = new SqlConnectionStringBuilder();

            // Modify the default value and set the same value on the both the builder objects above.
            connectionStringBuilder1.AttestationProtocol = protocol1;
            connectionStringBuilder2.AttestationProtocol = protocol1;
            connectionStringBuilder3.AttestationProtocol = protocol1;

            // Use the EquivalentTo function to compare both the builder objects and make sure the result is expected.
            Assert.True(connectionStringBuilder1.EquivalentTo(connectionStringBuilder2));
            Assert.True(connectionStringBuilder1.EquivalentTo(connectionStringBuilder3));
            Assert.Equal(connectionStringBuilder1.AttestationProtocol, connectionStringBuilder2.AttestationProtocol);
            Assert.Equal(connectionStringBuilder1.AttestationProtocol, connectionStringBuilder3.AttestationProtocol);

            connectionStringBuilder2.AttestationProtocol = protocol2;
            Assert.True(!connectionStringBuilder1.EquivalentTo(connectionStringBuilder2));
            Assert.True(!connectionStringBuilder3.EquivalentTo(connectionStringBuilder2));
            Assert.Equal(protocol2, connectionStringBuilder2.AttestationProtocol);

            connectionStringBuilder3.AttestationProtocol = protocol3;
            Assert.True(!connectionStringBuilder1.EquivalentTo(connectionStringBuilder3));
            Assert.True(!connectionStringBuilder2.EquivalentTo(connectionStringBuilder3));
            Assert.Equal(protocol3, connectionStringBuilder3.AttestationProtocol);
        }
Ejemplo n.º 2
0
        public void TestSqlConnectionStringBuilderEquivalentTo_EnclaveAttestationUrl()
        {
            string enclaveAttUrl1 = "www.foo.com";
            string enclaveAttUrl2 = "www.foo1.com";
            SqlConnectionStringBuilder connectionStringBuilder1 = new SqlConnectionStringBuilder();
            SqlConnectionStringBuilder connectionStringBuilder2 = new SqlConnectionStringBuilder();

            // Modify the default value and set the same value on the both the builder objects above.
            connectionStringBuilder1.EnclaveAttestationUrl = enclaveAttUrl1;
            connectionStringBuilder2.EnclaveAttestationUrl = enclaveAttUrl1;

            // Use the EquivalentTo function to compare both the builder objects and make sure the result is expected.
            Assert.True(connectionStringBuilder1.EquivalentTo(connectionStringBuilder2));

            connectionStringBuilder2.EnclaveAttestationUrl = enclaveAttUrl2;
            Assert.True(!connectionStringBuilder1.EquivalentTo(connectionStringBuilder2));
        }
Ejemplo n.º 3
0
        public void TestSqlConnectionStringBuilderEquivalentTo(
            SqlConnectionColumnEncryptionSetting sqlConnectionColumnEncryptionSetting1,
            SqlConnectionColumnEncryptionSetting sqlConnectionColumnEncryptionSetting2,
            bool isExpectedEquivelance)
        {
            SqlConnectionStringBuilder connectionStringBuilder1 = new SqlConnectionStringBuilder();
            SqlConnectionStringBuilder connectionStringBuilder2 = new SqlConnectionStringBuilder();

            // Modify the default value and set the same value on the both the builder objects above.
            connectionStringBuilder1.ColumnEncryptionSetting = sqlConnectionColumnEncryptionSetting1;
            connectionStringBuilder2.ColumnEncryptionSetting = sqlConnectionColumnEncryptionSetting2;

            // Use the EquivalentTo function to compare both the builder objects and make sure the result is expected.
            if (isExpectedEquivelance)
            {
                Assert.True(connectionStringBuilder1.EquivalentTo(connectionStringBuilder2));
            }
            else
            {
                Assert.False(connectionStringBuilder1.EquivalentTo(connectionStringBuilder2));
            }
        }