Пример #1
0
        public void LoadFileRepository()
        {
            dynamic queries     = new FileRepository(@"TestData\*.sql");
            string  selectQuery = queries.Select;

            TestDataUtility.AreEqual(selectQuery, ".sql", "select");
        }
Пример #2
0
        public void GetDbCommandText()
        {
            var     dbConnection = new DbConnectionMock();
            dynamic queries      = new DbCommandRepository(dbConnection, "TestData");
            string  commandText  = queries.Select; // Behavior inherited from FileRepository

            TestDataUtility.AreEqual(commandText, ".sql", "select");
        }
Пример #3
0
        public void GetDbCommand()
        {
            var        dbConnection = new DbConnectionMock();
            dynamic    queries      = new DbCommandRepository(dbConnection, "TestData");
            IDbCommand command      = queries.Select();

            TestDataUtility.AreEqual(command.CommandText, ".sql", "select");

            Assert.IsInstanceOfType(command, typeof(DbCommandMock));
            var commandMock = (DbCommandMock)command;

            Assert.AreEqual(0, commandMock.ParameterMocks.Count);
        }
Пример #4
0
        public void GenerateSimpleText()
        {
            var    generator = new MarkdownGenerator();
            string text      = generator
                               .Heading1("Heading 1")
                               .Text("This is a demo of text in ").Bold("bold").Text(", ").Italic("italic").LineEnd()
                               .Text("and ").Code("mono-spaced").ParagraphEnd()
                               .Heading2("Subheading: lists")
                               .Paragraph("First a numbered list:")
                               .Numbered("Some text", "other text", 42).Numbered("A new numbered list")
                               .Paragraph("Then a bullet list:")
                               .Bullet(1, "another bullet")
                               .ToString();

            TestDataUtility.AreEqual(text, ".md");
        }
Пример #5
0
        public void GetDbCommandWithParameters()
        {
            var        dbConnection = new DbConnectionMock();
            dynamic    queries      = new DbCommandRepository(dbConnection, "TestData");
            IDbCommand command      = queries.Select("Param1", 123);

            TestDataUtility.AreEqual(command.CommandText, ".sql", "select");

            Assert.IsInstanceOfType(command, typeof(DbCommandMock));
            var commandMock = (DbCommandMock)command;

            Assert.AreEqual(2, commandMock.ParameterMocks.Count);

            Assert.AreEqual("0", commandMock.ParameterMocks[0].ParameterName);
            Assert.AreEqual("Param1", commandMock.ParameterMocks[0].Value);

            Assert.AreEqual("1", commandMock.ParameterMocks[1].ParameterName);
            Assert.AreEqual(123, commandMock.ParameterMocks[1].Value);
        }