public void then_should_not_have_any_arguements()
            {
                // given
                var database = new DatabaseStub();

                // when
                database.QueryStoredProcedure<string>("MySpName");

                // then
                Sql executedSql = database.QuerySql;
                executedSql.Arguments.ShouldBeEmpty();
            }
            public void then_should_return_expected_result()
            {
                // given
                var database = new DatabaseStub { QueryResult = new object[] { "Hello You" } };

                // when
                string[] result = database.QueryStoredProcedure<string>("MySpName").ToArray();

                // then
                result.ShouldNotBeEmpty();
                result[0].ShouldEqual("Hello You");
            }
            public void then_should_call_sp_with_sp_name()
            {
                // given
                var database = new DatabaseStub();

                // when
                database.QueryStoredProcedure<string>("MySpName");

                // then
                Sql executedSql = database.QuerySql;
                executedSql.SQL.ShouldContain("EXEC");
                executedSql.SQL.ShouldContain("MySpName");
            }
示例#4
0
            public void then_should_not_have_any_arguements()
            {
                // given
                var database = new DatabaseStub();

                // when
                database.QueryStoredProcedure <string>("MySpName");

                // then
                Sql executedSql = database.QuerySql;

                executedSql.Arguments.ShouldBeEmpty();
            }
示例#5
0
            public void then_should_return_expected_result()
            {
                // given
                var database = new DatabaseStub {
                    QueryResult = new object[] { "Hello You" }
                };

                // when
                string[] result = database.QueryStoredProcedure <string>("MySpName").ToArray();

                // then
                result.ShouldNotBeEmpty();
                result[0].ShouldEqual("Hello You");
            }
示例#6
0
            public void then_should_call_sp_with_sp_name()
            {
                // given
                var database = new DatabaseStub();

                // when
                database.QueryStoredProcedure <string>("MySpName");

                // then
                Sql executedSql = database.QuerySql;

                executedSql.SQL.ShouldContain("EXEC");
                executedSql.SQL.ShouldContain("MySpName");
            }
            public void then_should_include_paramter_in_sql()
            {
                // given
                var database = new DatabaseStub();

                // when
                database.QueryStoredProcedure<string>("MySpName", new Parameter("Param1", "Value"));

                // then
                Sql executedSql = database.QuerySql;
                executedSql.Arguments.ShouldNotBeEmpty();
                executedSql.Arguments.Any(x => x.Equals("Value")).ShouldBeTrue();

                executedSql.SQL.ShouldContain("Param1");
            }
示例#8
0
            public void then_should_include_paramter_in_sql()
            {
                // given
                var database = new DatabaseStub();

                // when
                database.QueryStoredProcedure <string>("MySpName", new Parameter("Param1", "Value"));

                // then
                Sql executedSql = database.QuerySql;

                executedSql.Arguments.ShouldNotBeEmpty();
                executedSql.Arguments.Any(x => x.Equals("Value")).ShouldBeTrue();

                executedSql.SQL.ShouldContain("Param1");
            }