示例#1
0
        public void SalvarCarregarFuncoesLocalmente_UmaFuncao_FuncaoCarregada()
        {
            try
            {
                new FileService().RegisterService();
            }
            catch (ServicoJaRegistradoException) { }
            var FS = ServiceLocator.Get <IFileService>();

            FS.Deletar(FS.GetExePath("funcoes.json"));

            var microondas = new Microondas();

            var potencia  = 3;
            var tempo     = new TimeSpan(0, 0, 12);
            var nome      = "teste";
            var instrucao = "instrucao test";
            var caractere = '@';
            var alimento  = "alimento";

            microondas.CadastrarFuncao(potencia, tempo, nome, instrucao, caractere, alimento);

            microondas.SalvarFuncoesCadastradas();

            microondas.CarregarFuncoesCadastradas();

            var funcao = microondas.Funcoes.FirstOrDefault(f =>
                                                           f.Nome == nome && f.Instrucao == instrucao &&
                                                           f.Potencia == potencia && TimeSpan.Equals(f.Tempo, tempo) &&
                                                           f.Caractere == caractere && f.Alimento == alimento);

            Assert.IsNotNull(funcao);
        }