I am Unit Testing with Subsonic 3.0.0.3. Unit tests ran as expected with record count assertions passing. However the testing framework does not auto increment identity columns.
For example
var p1 = new Person() { Name = "Jack" };
p1.Add();
var p2 = new Person() { Name = "Jill" };
p2..Add();
var t1 = Person.SingleOrDefault(p => p.Name == "Jack");
var t2 = Person.SingleOrDefault(p => p.Name == "Jill");
Table structure read by the T4 template
CREATE TABLE Person
(
Id int IDENTITY(1,1) PRIMARY KEY
,Name NVARCHAR(255) NOT NULL
)
Connection string
<add name="SomeDb" connectionString="Test"/>
t1 and t2 have the name property set as expected, but the Id property is 0 for both.
Is this by design? If so how to deal with tests that require selecting records by ID?