Esempio n. 1
0
        public void TestDbConnectionTraceForAfterInlineUpdate()
        {
            // Prepare
            var trace      = new Mock <ITrace>();
            var connection = new CustomDbConnection();

            // Setup
            trace.Setup(t => t.AfterInlineUpdate(It.IsAny <CancellableTraceLog>()));

            // Act
            connection.InlineUpdate <TraceEntity>(new { Name = "Name" }, te => te.Id == 1, trace: trace.Object, statementBuilder: new SqlStatementBuilder());

            // Assert
            trace.Verify(t => t.AfterInlineUpdate(It.IsAny <TraceLog>()), Times.Once);
        }
Esempio n. 2
0
        public void TestDbConnectionStatementBuilderForInlineUpdate()
        {
            // Prepare
            var statementBuilder = new Mock <IStatementBuilder>();
            var connection       = new CustomDbConnection();

            // Setup
            statementBuilder.Setup(builder =>
                                   builder.CreateInlineUpdate <DataEntity>(
                                       It.IsAny <QueryBuilder <DataEntity> >(),
                                       It.IsAny <IEnumerable <Field> >(),
                                       It.IsAny <QueryGroup>()));

            // Act
            connection.InlineUpdate <DataEntity>(new { Name = "Name" }, e => e.Id == 1, statementBuilder: statementBuilder.Object);

            // Assert
            statementBuilder.Verify(builder =>
                                    builder.CreateInlineUpdate <DataEntity>(
                                        It.IsAny <QueryBuilder <DataEntity> >(),
                                        It.IsAny <IEnumerable <Field> >(),
                                        It.IsAny <QueryGroup>()), Times.Once);
        }