Listing 1 - Test Case (Minus Suite)



--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IF object_id('TestSetup')IS NOT Null   
    DROP PROCEDURE TestSetup
GO

CREATE PROCEDURE TestSetup
AS
    INSERT INTO Orders (orderID, item, itemCount) VALUES (42, 'widget', 2)
GO

--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IF object_id('TestDeleteOrder')IS NOT Null
    DROP PROCEDURE TestDeleteOrder
GO

CREATE PROCEDURE TestDeleteOrder
AS
    DECLARE @orderID int 
    SET @orderID = 42
    EXEC DeleteOrder @orderID

    DECLARE @count int
    SET @count = (SELECT count(*) FROM Orders WHERE orderID = @orderID)

    EXEC SPUnit.dbo.Assert @count, 0
GO

--%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IF object_id('TestUpdateOrder')IS NOT Null    
    DROP PROCEDURE TestUpdateOrder
GO
    CREATE PROCEDURE TestUpdateOrder
AS
    DECLARE @orderID int
    SET  @orderID = 42

    EXEC UpdateOrder @orderID, @newItem = 'foo'

    DECLARE @count int
    SET  @count = (SELECT count(*) FROM Orders WHERE orderID = @orderID)

    DECLARE @item varchar(50)
    SET  @item = (SELECT item FROM Orders WHERE orderID = @orderID)

    EXEC SPUnit.dbo.Assert @count, 1
    EXEC SPUnit.dbo.Assert @item, 'foo'
GO

Supporting web standards -- this file created with: W3C-Amaya