当我创建两个包含地理列并使用的表时 tSQlt.AssertEqualsTable,测试失败:
失败:数据类型的运算符无效。运算符等于,类型 等于地理。{,1}
有没有人知道tSQLt是否支持表格比较的地理数据类型?
答案 0 :(得分:2)
(Error) The table contains a datatype that is not supported for
tSQLt.AssertEqualsTable. Please refer to http://tsqlt.org/user-
guide/assertions/assertequalstable/ for a list of unsupported datatypes.
不兼容类型列表为:
然而,几乎总有一种解决方法。您可以在比较之前将值转换为兼容的数据类型,如下例所示:
EXEC tSQLt.NewTestClass 'DeliveryTests';
GO
CREATE PROCEDURE DeliveryTests.[test Order is matched to Customer location]
AS
BEGIN
EXEC tSQLt.FakeTable 'Sales.Customers';
EXEC tSQLt.FakeTable 'Sales.Orders';
INSERT INTO Sales.Customers (CustomerId, Location)
VALUES (1, geography::Point(47.65100, -122.34900, 4326));
INSERT INTO Sales.Orders (OrderId, CustomerId)
VALUES (5, 1);
SELECT OrderId, Location.ToString() AS Location
INTO DeliveryTests.Actual
FROM Delivery.OrderDestinations;
SELECT TOP(0) *
INTO DeliveryTests.Expected
FROM DeliveryTests.Actual;
INSERT INTO DeliveryTests.Expected (OrderId, Location)
VALUES (5, geography::Point(47.65100, -122.34900, 4326).ToString());
EXEC tSQLt.AssertEqualsTable 'DeliveryTests.Expected',
'DeliveryTests.Actual';
END;
GO
答案 1 :(得分:0)
目前尚不支持,但将包含在下一个/将来的版本中。