mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
Create TSQL script for test case: one right row
This commit is contained in:
+66
@@ -0,0 +1,66 @@
|
||||
-------------------------------------------------------------------------
|
||||
-- Demo: SQL Server CI/CD -
|
||||
-- -
|
||||
-- Script: Test case: try to insert one right row -
|
||||
-- Author: Sergio Govoni -
|
||||
-- Notes: -- -
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
SET QUOTED_IDENTIFIER ON;
|
||||
GO
|
||||
|
||||
CREATE OR ALTER PROCEDURE UnitTestTRProductSafetyStockLevel.[test try to insert one right row]
|
||||
AS
|
||||
BEGIN
|
||||
/*
|
||||
Arrange:
|
||||
Spy the procedure Production.usp_Raiserror_SafetyStockLevel
|
||||
*/
|
||||
EXEC tSQLt.SpyProcedure 'Production.usp_Raiserror_SafetyStockLevel';
|
||||
|
||||
/*
|
||||
Act:
|
||||
Try to insert one right row with SafetyStockLevel lower than 10
|
||||
*/
|
||||
INSERT INTO Production.Product
|
||||
(
|
||||
[Name]
|
||||
,ProductNumber
|
||||
,MakeFlag
|
||||
,FinishedGoodsFlag
|
||||
,SafetyStockLevel
|
||||
,ReorderPoint
|
||||
,StandardCost
|
||||
,ListPrice
|
||||
,DaysToManufacture
|
||||
,SellStartDate
|
||||
,rowguid
|
||||
,ModifiedDate
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
N'Carbon Bar 1'
|
||||
,N'CB-0001'
|
||||
,0
|
||||
,0
|
||||
,20 /* SafetyStockLevel */
|
||||
,750
|
||||
,0.0000
|
||||
,78.0000
|
||||
,0
|
||||
,GETDATE()
|
||||
,NEWID()
|
||||
,GETDATE()
|
||||
);
|
||||
|
||||
/*
|
||||
Assert
|
||||
*/
|
||||
IF EXISTS (SELECT _id_ FROM Production.usp_Raiserror_SafetyStockLevel_SpyProcedureLog)
|
||||
EXEC tSQLt.Fail
|
||||
@Message0 = 'Production.usp_Raiserror_SafetyStockLevel_SpyProcedureLog is not empty!';
|
||||
END;
|
||||
GO
|
||||
|
||||
EXEC tSQLt.Run 'UnitTestTRProductSafetyStockLevel.[test try to insert one right row]';
|
||||
GO
|
||||
Reference in New Issue
Block a user