Пример #1
0
        public void TestDbConnectionTraceForBeforeDelete()
        {
            // Prepare
            var trace      = new Mock <ITrace>();
            var connection = new CustomDbConnection();

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

            // Act
            connection.Delete <TraceEntity>(0, trace: trace.Object, statementBuilder: new SqlStatementBuilder());

            // Assert
            trace.Verify(t => t.BeforeDelete(It.IsAny <CancellableTraceLog>()), Times.Once);
        }
Пример #2
0
        public void TestDbConnectionStatementBuilderForDelete()
        {
            // Prepare
            var statementBuilder = new Mock <IStatementBuilder>();
            var connection       = new CustomDbConnection();

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

            // Act
            connection.Delete <DataEntity>(e => e.Id == 1, statementBuilder: statementBuilder.Object);

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