Exemple #1
0
        public when_querying_with_more_columns_than_what_is_being_mapped()
        {
            TestingUtils.PostgresCommand("DROP TABLE IF EXISTS skinny_testing");
            TestingUtils.PostgresCommand("CREATE TABLE skinny_testing (title varchar(100), not_being_mapped varchar(200))");
            TestingUtils.PostgresCommand("INSERT INTO skinny_testing (title) VALUES ('some testing')");

            var connection = new Connection(Settings.ConnectionString);

            var query = "SELECT * FROM skinny_testing where title = @title";

            var parameters = new Dictionary <string, object>()
            {
                { "title", "some testing" }
            };

            actual = connection.Query <SkinnyTestingDatabaseRecord>(query, parameters);
        }
Exemple #2
0
        public when_executing_a_command_with_parameters()
        {
            var connection = new Connection(Settings.ConnectionString);

            var dropTableCommand = "DROP TABLE IF EXISTS skinny_testing";

            connection.Command(dropTableCommand, new Dictionary <string, object>());

            var createTableCommand = "CREATE TABLE skinny_testing (title varchar(100))";

            connection.Command(createTableCommand, new Dictionary <string, object>());

            var insertCommand = "INSERT INTO skinny_testing (title) VALUES (@title)";
            var parameters    = new Dictionary <string, object>()
            {
                { "title", "some testing" }
            };

            actual = connection.Command(insertCommand, parameters);

            writtenToDatabase = TestingUtils.PostgresQuery("SELECT * FROM skinny_testing");
        }