Exemplo n.º 1
0
        public void Uses_existing_Guid_Id_if_not_Empty_for_row_inserts()
        {
            using var db = OpenDbConnection();
            db.DropAndCreateTable <GuidAutoId>();

            var existingGuid = Guid.NewGuid();
            var guidA        = new GuidAutoId {
                Id = existingGuid, Name = "A"
            };

            db.Exec(cmd => {
                cmd.CommandText = DialectProvider.ToInsertRowStatement(cmd, guidA);
                DialectProvider.SetParameterValues <GuidAutoId>(cmd, guidA);
                cmd.ExecuteNonQuery();
            });

            var fromDb = db.SingleById <GuidAutoId>(existingGuid);

            Assert.That(fromDb.Id, Is.EqualTo(existingGuid));
        }