I'm trying to write some unit tests, using NUnit, for code that relies on DbGeography.PointFromText(text, 4326), which requires Microsoft.SqlServer.Types be loaded. I'm trying to load it using:
[OneTimeSetUp]
public void Startup()
{
SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
}
I have also tried to use load them in a [Setup] method. When the code that uses DbGeography is called, I end up with the lovely exception:
System.InvalidOperationException : Spatial types and functions are not available for this provider because the assembly 'Microsoft.SqlServer.Types' version 10 or higher could not be found.
I do have the Microsoft.SqlServer.Types Nuget package installed, and it is working fine and dandy in my Web API 2.2 application.