示例#1
0
        public void CreateTrackedContextWorksAsExpected()
        {
            // --- Arrange
            var dc = new SqlDatabase(DB_CONN);
            dc.Execute("delete from [dbo].[Sample]");

            // --- Act
            List<SampleRecord> records;
            using (var ctx = DataAccessFactory.CreateTrackedContext<ITestDataOperations>())
            {
                ctx.InsertSample(new SampleRecord { Id = 0, Name = "Haho" });
                ctx.InsertSample(new SampleRecord { Id = 0, Name = "Hello" });
                records = ctx.GetAllSamples();
            }

            // --- Assert
            records.ShouldHaveCountOf(2);
        }