I am testing my service layer which contains some calls to repositories by using the SQLite database provider. My test class has been written according to the following introduction: https://docs.microsoft.com/en-us/ef/core/miscellaneous/testing/sqlite
For the entity which is written to the database in this test case, the Guid is generated on database:
entity.Property(e => e.Guid).HasDefaultValueSql("newid()");
Now when trying to add a new entity (without explicitely setting the Guid), I get following exception:
SQLite Error 1: 'unknown function: newid()'.
Is there a way around this issue? It seems like this function is simply not supported. As the database I am working with is quite old I am afraid to find more places like this which may not work.
My hope was to get better unit tests with SQLite than using the InMemoryDatabase provider which does not really suits for testing "relational database functionalities". But if this problem cannot be solved, I am stuck and probably need to stick to integration tests (at least for the data access part of my services)