Exemplo n.º 1
0
        public void Client_deve_assumir_configuracao_por_arquivo_caso_nenhum_IMessageConfig_seja_informado()
        {
            //Garantir que existe um arquivo de configuração antes
            string fullPath = Path.Combine(folder, "messaging.config");

            if (!File.Exists(fullPath))
            {
                Assert.Fail("Arquivo não encontrado.");
            }

            var clientSemException = new Messaging();

            clientSemException.Dispose();

            //renomear o arquivo
            var file = new FileInfo(fullPath);

            file.MoveTo(Path.Combine(folder, "renomeado.txt"));

            //Instancia deve não encontrar mais o arquivo
            Assert.ThrowsException <FileNotFoundException>(() => new Messaging());

            //Des-renomear
            file.MoveTo(fullPath);
        }