Esempio n. 1
0
        public static void IsMaterialized_PropertyGet_ReturnsTrue()
        {
            Identifier   viewName   = "test_mat_view";
            const string definition = "select * from test";
            var          columns    = new[] { Mock.Of <IDatabaseColumn>() };

            var view = new DatabaseMaterializedView(viewName, definition, columns);

            Assert.That(view.IsMaterialized, Is.True);
        }
Esempio n. 2
0
        public static void Definition_PropertyGet_EqualsCtorArg()
        {
            Identifier   viewName   = "test_mat_view";
            const string definition = "select * from test";
            var          columns    = new[] { Mock.Of <IDatabaseColumn>() };

            var view = new DatabaseMaterializedView(viewName, definition, columns);

            Assert.That(view.Definition, Is.EqualTo(definition));
        }
Esempio n. 3
0
        public static void ToString_WhenInvoked_ReturnsExpectedString(string schema, string localName, string expectedOutput)
        {
            var          viewName   = Identifier.CreateQualifiedIdentifier(schema, localName);
            const string definition = "select * from test";
            var          columns    = new[] { Mock.Of <IDatabaseColumn>() };

            var view = new DatabaseMaterializedView(viewName, definition, columns);

            var result = view.ToString();

            Assert.That(result, Is.EqualTo(expectedOutput));
        }
Esempio n. 4
0
        public static void Columns_PropertyGet_EqualsCtorArg()
        {
            Identifier   viewName   = "test_mat_view";
            const string definition = "select * from test";

            Identifier columnName = "star";
            var        columnMock = new Mock <IDatabaseColumn>();

            columnMock.SetupGet(c => c.Name).Returns(columnName);
            var columns = new[] { columnMock.Object };

            var view           = new DatabaseMaterializedView(viewName, definition, columns);
            var viewColumnName = view.Columns[0].Name;

            Assert.That(viewColumnName, Is.EqualTo(columnName));
        }