我正在使用SSDT进行单元测试(https://msdn.microsoft.com/en-us/library/jj851200(v=vs.103).aspx)而且我无法找到一种方法来设置resx文件之外的存储过程的参数,在每个人都可以使用的C#文件中接取。
有办法吗?
一个例子:
-- database unit test for dbo.InsertFuncionario
DECLARE @RC AS INT, @ID AS INT, @SedeID AS SMALLINT, @nome AS VARCHAR (200), @cpf AS VARCHAR (11), @PISPASEP AS VARCHAR (11), @certificadoReservista AS VARCHAR (20), @cargoID AS SMALLINT, @dataNascimento AS SMALLDATETIME, @dataAdmissao AS SMALLDATETIME, @horarioTrabalho AS VARCHAR (100), @grauInstrucaoID AS SMALLINT, @folgaSemanal AS VARCHAR (100), @salario AS MONEY, @autorizadoPor AS VARCHAR (200), @estadoCivil AS VARCHAR (20), @dataDemissao AS SMALLDATETIME, @nomeImagem AS VARCHAR (200), @codigoANAC AS VARCHAR (20), @foto AS VARCHAR (MAX), @licenca AS VARCHAR (20);
SELECT @RC = 0,
@SedeID = 1,
@nome = 'CANINDE SISTEMAS PARA AVIACAO',
@cpf = '07996501610',
@PISPASEP = NULL,
@certificadoReservista = NULL,
@cargoID = 1,
@dataNascimento = '19871127',
@dataAdmissao = getdate(),
@horarioTrabalho = NULL,
@grauInstrucaoID = 6,
@folgaSemanal = NULL,
@salario = NULL,
@autorizadoPor = NULL,
@estadoCivil = NULL,
@dataDemissao = NULL,
@nomeImagem = NULL,
@codigoANAC = NULL,
@foto = NULL,
@licenca = NULL;
EXECUTE @RC = [dbo].[InsertFuncionario] @ID OUTPUT, @SedeID, @nome, @cpf, @PISPASEP, @certificadoReservista, @cargoID, @dataNascimento, @dataAdmissao, @horarioTrabalho, @grauInstrucaoID, @folgaSemanal, @salario, @autorizadoPor, @estadoCivil, @dataDemissao, @nomeImagem, @codigoANAC, @foto, @licenca;
SELECT @RC AS RC,
@ID AS ID;
现在,我认为的解决方案是为我的测试提供一个键值表,并在每次我想要一个值时进行选择。
@nome的值将在一个表中,我将在预测试中插入一个。我将更改resx查询,进行选择并检索值。