Exemplo n.º 1
0
        public void CanAddSqlUpdateProperly()
        {
            var script = new DbScript();

            script.Add(new SqlUpdate(new TestRow
            {
                TestId      = 1,
                Description = "Test"
            }));

            Assert.Equal(TestSqlHelper.Normalize(
                             "DECLARE @p1 NVARCHAR(4) = 'Test';" +
                             "DECLARE @p2 BIGINT = 1;" +
                             "UPDATE Tests SET Description = @p1 WHERE TestId = @p2"),
                         TestSqlHelper.Normalize(script.ToString()));
        }
Exemplo n.º 2
0
        public void CanAddSqlInsertProperly()
        {
            var script = new DbScript();

            script.Add(new SqlInsert(new TestRow
            {
                TrackAssignments = true,
                TestId           = 1,
                Description      = "Test"
            }));

            Assert.Equal(TestSqlHelper.Normalize(
                             "DECLARE @p1 INT = 1;" +
                             "DECLARE @p2 NVARCHAR(4) = 'Test';" +
                             "INSERT INTO Tests (TestId, Description) VALUES (@p1, @p2)"),
                         TestSqlHelper.Normalize(script.ToString()));
        }