Another “simple” question is about the objects of the unified testing model that use the level of access to data.
When I make fun of my Table<Customer>up IQuerable<ICustomer>, where it is new List<FakeCustomer>().AsQuerable()used as a data store in memory, the following code passes unit test perfectly:
var filteredCustomers = from c in dal.Customers
where c.Code.ToUpperInvariant() == "ABC"
select c;
When I start the application, I certainly get NotSupportedException(because of ToUpperInvariant()). Perhaps this is a rather lame example, because the problem can be fixed by replacing it ToUpperInvariant()with ToUpper(), but you got this point.
Question: is such inconsistency a “payment” for recording a real unit, but not integration tests? Or maybe I'm doing something wrong, for example. should there be another way to mock the DataContext in such a way as to fully mimic the Linq To SQL DataContext?
I am currently running a test database instead of a layout in memory to catch such errors.
Thanks for your suggestions.
Roman source
share