public void ValidarEntrada_ComArquivo_Sucesso() { try { new FileService().RegisterService(); } catch (ServicoJaRegistradoException) { } var FS = ServiceLocator.Get <IFileService>(); var potencia = 3; var tempo = new TimeSpan(0, 0, 12); var nome = "teste"; var instrucao = "instrucao test"; var caractere = '@'; var alimento = "porco"; FS.Salvar(FS.GetExePath("arquivo.txt"), alimento); var funcao = new FuncaoMicroondas(potencia, tempo, nome, instrucao, caractere, alimento); var arquivoAlimento = FS.Carregar(FS.GetExePath("arquivo.txt")); var exceptionGerado = false; try { funcao.ValidarEntrada(arquivoAlimento); } catch (Exception) { exceptionGerado = true; } Assert.IsFalse(exceptionGerado); }
public void ValidarEntrada_SemArquivo_Falha() { var potencia = 3; var tempo = new TimeSpan(0, 0, 12); var nome = "teste"; var instrucao = "instrucao test"; var caractere = '@'; var alimento = "porco"; var funcao = new FuncaoMicroondas(potencia, tempo, nome, instrucao, caractere, alimento); var exceptionGerado = false; try { funcao.ValidarEntrada("123", false); } catch (Exception) { exceptionGerado = true; } Assert.IsTrue(exceptionGerado); }