Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/API/AdventureWorksDemo.API/AdventureWorksDemo.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.1" />
<PackageReference Include="Scalar.AspNetCore" Version="2.0.12" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.1" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.2" />
<PackageReference Include="Scalar.AspNetCore" Version="2.0.18" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.2" />
<PackageReference Include="System.Text.Json" Version="9.0.2" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
}
},
"ConnectionStrings": {
"Target": "Data Source=localhost,1433;Initial Catalog=AdventureWorks;Persist Security Info=True;User ID=sa;Password=<MyStrongPassword0987>;TrustServerCertificate=True;"
"Target": "Data Source=localhost,1433;Initial Catalog=AdventureWorks;Persist Security Info=True;User ID=sa;Password=<MyStrongPassword0987>;Encrypt=false;TrustServerCertificate=True;"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,31 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.1" />
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" Version="9.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.2" />
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" Version="9.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="MSTest.Analyzers" Version="3.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Polly" Version="8.5.2" />
<PackageReference Include="Reqnroll.MsTest" Version="2.2.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.7.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.7.3" />
<PackageReference Include="Testcontainers.MsSql" Version="4.1.0" />
<PackageReference Include="Reqnroll.MsTest" Version="2.3.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.8.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.8.2" />
<PackageReference Include="Testcontainers.MsSql" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AdventureWorksDemo.Common.Tests.Extensions\AdventureWorksDemo.Common.Tests.Extensions.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="DatabaseSetup\PrepareTablesForTesting.sql">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DBCC SHRINKDATABASE(N'$TARGET_DB_NAME', 5 );

BACKUP DATABASE [$TARGET_DB_NAME] TO DISK = N'/var/opt/mssql/backup/$BackupFileName' WITH NOFORMAT, INIT,
NAME = N'AdventureWorks-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
;
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ GO
DROP DATABASE [AdventureWorks]

USE [master]
RESTORE DATABASE [AdventureWorks] FROM DISK = N'/var/opt/mssql/backup/SampleDatabase.bak' WITH FILE = 1,
MOVE N'AdventureWorksLT2022_Data' TO N'/var/opt/mssql/data/AdventureWorks.mdf',
MOVE N'AdventureWorksLT2022_Log' TO N'/var/opt/mssql/data/AdventureWorks_log.ldf',
RESTORE DATABASE [AdventureWorks] FROM DISK = N'/var/opt/mssql/backup/AdventureWorks.bak' WITH FILE = 1,
MOVE N'AdventureWorks2022' TO N'/var/opt/mssql/data/AdventureWorks.mdf',
MOVE N'AdventureWorks2022_Log' TO N'/var/opt/mssql/data/AdventureWorks_log.ldf',
NOUNLOAD,
STATS = 5

Expand All @@ -33,65 +33,65 @@ declare @Customers as table(customerId int);
insert Into @Customers
select top 7 max(CustomerID) CustomerId

from [AdventureWorks].[SalesLT].[SalesOrderDetail] [d]
Inner Join [AdventureWorks].[SalesLT].[SalesOrderHeader] [h] on h.SalesOrderID= d.SalesOrderID
from [AdventureWorks].[Production].[SalesOrderDetail] [d]
Inner Join [AdventureWorks].[Production].[SalesOrderHeader] [h] on h.SalesOrderID= d.SalesOrderID
GROUP by d.SalesOrderID
Having count([d].salesOrderDetailId) <10

-- -- --
PRINT 'Delete From [AdventureWorks].[SalesLT].[SalesOrderHeader]';
PRINT 'Delete From [AdventureWorks].[Production].[SalesOrderHeader]';
DELETE
-- select *
from [AdventureWorks].[SalesLT].[SalesOrderHeader] where CustomerID not in (select CustomerId from @Customers);
from [AdventureWorks].[Production].[SalesOrderHeader] where CustomerID not in (select CustomerId from @Customers);
-- -- --
--------PRINT 'Delete From [AdventureWorks].[SalesLT].[SalesOrderDetail]';
--------PRINT 'Delete From [AdventureWorks].[Production].[SalesOrderDetail]';
--------DELETE
-------- -- select *
-------- from [AdventureWorks].[SalesLT].[SalesOrderDetail] where SalesOrderID not in (select SalesOrderID from [AdventureWorks].[SalesLT].[SalesOrderHeader]);
-------- from [AdventureWorks].[Production].[SalesOrderDetail] where SalesOrderID not in (select SalesOrderID from [AdventureWorks].[Production].[SalesOrderHeader]);
-- -- --
PRINT 'Delete From [AdventureWorks].[SalesLT].[CustomerAddress]';
PRINT 'Delete From [AdventureWorks].[Production].[CustomerAddress]';
DELETE
-- select *
from [AdventureWorks].[SalesLT].[CustomerAddress] where CustomerID not in (select CustomerId from @Customers);
from [AdventureWorks].[Production].[CustomerAddress] where CustomerID not in (select CustomerId from @Customers);
-- -- --
PRINT 'Delete From [AdventureWorks].[SalesLT].[Address]';
PRINT 'Delete From [AdventureWorks].[Production].[Address]';
DELETE
-- select *
from [AdventureWorks].[SalesLT].[Customer] where CustomerID not in (select CustomerId from @Customers);
from [AdventureWorks].[Production].[Customer] where CustomerID not in (select CustomerId from @Customers);
-- -- --
PRINT 'Delete From [AdventureWorks].[SalesLT].[Customer]';
PRINT 'Delete From [AdventureWorks].[Production].[Customer]';
DELETE
-- select *
from [AdventureWorks].[SalesLT].[Address] where AddressID not in (select AddressID from [AdventureWorks].[SalesLT].[CustomerAddress])
from [AdventureWorks].[Production].[Address] where AddressID not in (select AddressID from [AdventureWorks].[Production].[CustomerAddress])
-- -- --
PRINT 'Delete From [AdventureWorks].[SalesLT].[Product]';
PRINT 'Delete From [AdventureWorks].[Production].[Product]';
DELETE
-- select *
FROM [AdventureWorks].[SalesLT].[Product] where productId in
(select top 99 percent productId from [AdventureWorks].[SalesLT].[Product] where ProductId not in (select ProductId from [AdventureWorks].[SalesLT].[SalesOrderDetail]) order by ProductId)
FROM [AdventureWorks].[Production].[Product] where productId in
(select top 99 percent productId from [AdventureWorks].[Production].[Product] where ProductId not in (select ProductId from [AdventureWorks].[Production].[SalesOrderDetail]) order by ProductId)


-- -- --
PRINT 'Delete From [AdventureWorks].[SalesLT].[ProductModelProductDescription]';
PRINT 'Delete From [AdventureWorks].[Production].[ProductModelProductDescription]';
DELETE
-- select *
FROM [AdventureWorks].[SalesLT].[ProductModelProductDescription] where productModelId Not in (select productModelId from [AdventureWorks].[SalesLT].[Product] )
FROM [AdventureWorks].[Production].[ProductModelProductDescription] where productModelId Not in (select productModelId from [AdventureWorks].[Production].[Product] )
or [Culture] not in ('en','fr');
-- -- --
PRINT 'Delete From [AdventureWorks].[SalesLT].[ProductDescription]';
PRINT 'Delete From [AdventureWorks].[Production].[ProductDescription]';
DELETE
-- select *
FROM [AdventureWorks].[SalesLT].[ProductDescription] where [ProductDescriptionID] Not in (select [ProductDescriptionID] from [AdventureWorks].[SalesLT].[ProductModelProductDescription] )
FROM [AdventureWorks].[Production].[ProductDescription] where [ProductDescriptionID] Not in (select [ProductDescriptionID] from [AdventureWorks].[Production].[ProductModelProductDescription] )
-- -- --
PRINT 'Delete From [AdventureWorks].[SalesLT].[ProductModel]';
PRINT 'Delete From [AdventureWorks].[Production].[ProductModel]';
DELETE
-- select *
FROM [AdventureWorks].[SalesLT].[ProductModel] where productModelId Not in (select productModelId from [AdventureWorks].[SalesLT].[Product] )
FROM [AdventureWorks].[Production].[ProductModel] where productModelId Not in (select productModelId from [AdventureWorks].[Production].[Product] )
-- -- --
PRINT 'Delete From [AdventureWorks].[SalesLT].[ProductCategory]';
PRINT 'Delete From [AdventureWorks].[Production].[ProductCategory]';
DELETE
-- select *
FROM [AdventureWorks].[SalesLT].[ProductCategory] where ProductCategoryID Not in (select ProductCategoryID from [AdventureWorks].[SalesLT].[Product] )
FROM [AdventureWorks].[Production].[ProductCategory] where ProductCategoryID Not in (select ProductCategoryID from [AdventureWorks].[Production].[Product] )
AND ParentProductCategoryID = null

GO
Loading