I'm using Effort 2.2.13.0 in my unit test project (xUnit). In a fixture, I'm adding company data to the Company table in the in-memory database.
CompanyId = 1, Name = "Company 1"
CompanyId = 2, Name = "Company 2"
CompanyId = 3, Name = "Company 3"
The strange behaviour is that after calling SaveChanges to store the data to the database, Company 2 has id 3 and Company 3 has id 2.
The fixture:
public class SharedDatabaseFixture
{
public SharedDatabaseFixture()
{
var connection = DbConnectionFactory.CreateTransient();
Context = new TestDbContext(connection);
Seed();
}
public TestDbContext Context { get; }
private void Seed()
{
var addresses = AddressSeed.Get();
var countries = CountrySeed.Get();
var stores = StoreSeed.Get();
var companies = CompanySeed.Get();
var products = ProductSeed.Get();
Context.Countries.AddRange(countries);
Context.Companies.AddRange(companies);
<!-- companies list is still correct -->
Context.SaveChanges();
<!-- Company 2 has id 3, company 3 has id 2 -->
}
}
I'm presetting the id's in the companies list, I also tried leaving them empty, but the result is the same. Anyone seen this odd behaviour before?