Skip to content

Instantly share code, notes, and snippets.

@stepbester
Last active August 3, 2021 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stepbester/2877fbcff8cf154c19e48f8354d1cc73 to your computer and use it in GitHub Desktop.
Save stepbester/2877fbcff8cf154c19e48f8354d1cc73 to your computer and use it in GitHub Desktop.
SQL Unit Test for FixZoneName
ALTER PROCEDURE [UnitTests].[test FixZoneName]
AS
BEGIN
--Assemble
EXEC tSQLt.FakeTable @TableName = 'sth.GameZone';
INSERT INTO sth.GameZone(Id, ZoneName)
VALUES(1, 'Green Hill');
--Act
EXEC sth.FixZoneName @zoneId = 1;
--Assert
DECLARE @actualZoneName VARCHAR(50);
SELECT @actualZoneName = ZoneName
FROM sth.GameZone
WHERE Id = 1;
EXEC tSQLt.AssertEqualsString @Expected = 'Green Hill Zone',
@Actual = @actualZoneName,
@Message = 'Zone name was not fixed';
END;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment