-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part of #14572
- Loading branch information
Showing
5 changed files
with
148 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
test/EFCore.VisualBasic.FunctionalTests/EFCore.VisualBasic.FunctionalTests.vbproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<RootNamespace>Microsoft.EntityFrameworkCore</RootNamespace> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<AssemblyName>Microsoft.EntityFrameworkCore.VisualBasic.FunctionalTests</AssemblyName> | ||
<SkipTests Condition="'$(OS)' != 'Windows_NT' AND '$(Test__SqlServer__DefaultConnection)' == ''">True</SkipTests> | ||
<LangVersion>latest</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\EFCore.SqlServer.FunctionalTests\EFCore.SqlServer.FunctionalTests.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
96 changes: 96 additions & 0 deletions
96
test/EFCore.VisualBasic.FunctionalTests/NorthwindQueryVisualBasicTest.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
' Licensed to the .NET Foundation under one or more agreements. | ||
' The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
Imports Microsoft.EntityFrameworkCore.Query | ||
Imports Microsoft.EntityFrameworkCore.TestModels.Northwind | ||
Imports Microsoft.EntityFrameworkCore.TestUtilities | ||
Imports Xunit | ||
|
||
Partial Public Class NorthwindQueryVisualBasicTest | ||
Inherits QueryTestBase(Of NorthwindQuerySqlServerFixture(Of NoopModelCustomizer)) | ||
|
||
Public Sub New(fixture As NorthwindQuerySqlServerFixture(Of NoopModelCustomizer)) | ||
MyBase.New(fixture) | ||
|
||
fixture.TestSqlLoggerFactory.Clear() | ||
End Sub | ||
|
||
<ConditionalTheory> | ||
<MemberData(NameOf(IsAsyncData))> | ||
Public Async Sub CompareString_Equals_Binary(async As Boolean) | ||
Await AssertQuery( | ||
async, | ||
Function(ss) ss.Set(Of Customer).Where(Function(c) c.CustomerID = "ALFKI"), | ||
entryCount:=1) | ||
|
||
AssertSql( | ||
"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] | ||
FROM [Customers] AS [c] | ||
WHERE [c].[CustomerID] = N'ALFKI'") | ||
End Sub | ||
|
||
<ConditionalTheory> | ||
<MemberData(NameOf(IsAsyncData))> | ||
Public Async Sub CompareString_LessThanOrEqual_Binary(async As Boolean) | ||
Await AssertQuery( | ||
async, | ||
Function(ss) ss.Set(Of Customer).Where(Function(c) c.CustomerID <= "ALFKI"), | ||
entryCount:=1) | ||
|
||
AssertSql( | ||
"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] | ||
FROM [Customers] AS [c] | ||
WHERE [c].[CustomerID] <= N'ALFKI'") | ||
End Sub | ||
|
||
<ConditionalTheory> | ||
<MemberData(NameOf(IsAsyncData))> | ||
Public Async Sub AddChecked(async As Boolean) | ||
Await AssertQuery( | ||
async, | ||
Function(ss) ss.Set(Of Product).Where(Function(p) p.UnitsInStock + 1 = 102), | ||
entryCount:=1) | ||
|
||
AssertSql( | ||
"SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] | ||
FROM [Products] AS [p] | ||
WHERE [p].[UnitsInStock] + CAST(1 AS smallint) = CAST(102 AS smallint)") | ||
End Sub | ||
|
||
<ConditionalTheory> | ||
<MemberData(NameOf(IsAsyncData))> | ||
Public Async Sub SubtractChecked(async As Boolean) | ||
Await AssertQuery( | ||
async, | ||
Function(ss) ss.Set(Of Product).Where(Function(p) p.UnitsInStock - 1 = 100), | ||
entryCount:=1) | ||
|
||
AssertSql( | ||
"SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] | ||
FROM [Products] AS [p] | ||
WHERE [p].[UnitsInStock] - CAST(1 AS smallint) = CAST(100 AS smallint)") | ||
End Sub | ||
|
||
<ConditionalTheory> | ||
<MemberData(NameOf(IsAsyncData))> | ||
Public Async Sub MultiplyChecked(async As Boolean) | ||
Await AssertQuery( | ||
async, | ||
Function(ss) ss.Set(Of Product).Where(Function(p) p.UnitsInStock * 1 = 101), | ||
entryCount:=1) | ||
|
||
AssertSql( | ||
"SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] | ||
FROM [Products] AS [p] | ||
WHERE [p].[UnitsInStock] * CAST(1 AS smallint) = CAST(101 AS smallint)") | ||
End Sub | ||
|
||
Protected Overrides Function CreateQueryAsserter(fixture As NorthwindQuerySqlServerFixture(Of NoopModelCustomizer)) As QueryAsserter | ||
Return New RelationalQueryAsserter( | ||
fixture, AddressOf RewriteExpectedQueryExpression, AddressOf RewriteServerQueryExpression, canExecuteQueryString:=True) | ||
End Function | ||
|
||
Private Sub AssertSql(ParamArray expected As String()) | ||
Fixture.TestSqlLoggerFactory.AssertBaseline(expected) | ||
End Sub | ||
End Class |
29 changes: 29 additions & 0 deletions
29
test/EFCore.VisualBasic.FunctionalTests/NorthwindTextQueryVisualBasicTest.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
' Licensed to the .NET Foundation under one or more agreements. | ||
' The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
Option Compare Text | ||
Imports Microsoft.EntityFrameworkCore.Diagnostics | ||
Imports Microsoft.EntityFrameworkCore.TestModels.Northwind | ||
Imports Xunit | ||
|
||
Partial Public Class NorthwindQueryVisualBasicTest | ||
<ConditionalTheory> | ||
<MemberData(NameOf(IsAsyncData))> | ||
Public Function CompareString_Equals_Text(async As Boolean) As Task | ||
Return AssertTranslationFailedWithDetails( | ||
Function() AssertQuery( | ||
async, | ||
Function(ss) ss.Set(Of Customer).Where(Function(c) c.CustomerID = "ALFKI")), | ||
CoreStrings.QueryUnableToTranslateMethod("string", "Compare")) | ||
End Function | ||
|
||
<ConditionalTheory> | ||
<MemberData(NameOf(IsAsyncData))> | ||
Public Function CompareString_LessThanOrEqual_Text(async As Boolean) As Task | ||
Return AssertTranslationFailedWithDetails( | ||
Function() AssertQuery( | ||
async, | ||
Function(ss) ss.Set(Of Customer).Where(Function(c) c.CustomerID <= "ALFKI")), | ||
CoreStrings.QueryUnableToTranslateMethod("string", "Compare")) | ||
End Function | ||
End Class |