Esempio n. 1
0
        public void TestSQL()
        {
            var sut = new SqlDataClient();

            Action act = () =>
            {
                sut.OpenConnection();
                sut.ExecuteSqlCommand();
                sut.CloseConnection();
            };

            act.ShouldNotThrow <Exception>("No ha superado la validación de SQL");
        }
            public static void ISPDemo()
            {
                Console.WriteLine("\n\nInterface Inversion Principle Demo ");

                // Each client will implement their respective methods no base class forces the other client to implement the methods which dont required.
                // From the above implementation, we are not forcing Sql client to implemnt orcale logic or Oracle client to implement sql logic.

                ISqlDataProvider SqlDataProviderObject = new SqlDataClient();

                SqlDataProviderObject.OpenConnection();
                SqlDataProviderObject.ExecuteSqlCommand();
                SqlDataProviderObject.CloseConnection();

                IOracleDataProvider OracleDataProviderObject = new OracleDataClient();

                OracleDataProviderObject.OpenConnection();
                OracleDataProviderObject.ExecuteOracleCommand();
                OracleDataProviderObject.CloseConnection();
            }