public void mapThis_shouldThrowMyException() { //arrange string inp = "HELLO WORLD"; string pathMap = @"mapaAlfa.txt"; IMapService mapGen = new MapService(new StringService(), new FileService()); Dictionary <char, int> map = mapGen.getMap(pathMap); InputMapperService maperService = new InputMapperService(map); //act string actual = maperService.mapThis(inp); //assert }
public void mapThis_shouldBeSuccess() { //arrange string inp = "hola mi amigo como te va"; string expected = "44666555206444026444 46660222666 6 666083308882"; string pathMap = @"mapaAlfa.txt"; IMapService mapGen = new MapService(new StringService(), new FileService()); Dictionary <char, int> map = mapGen.getMap(pathMap); InputMapperService maperService = new InputMapperService(map); //act string actual = maperService.mapThis(inp); //assert Assert.AreEqual(actual, expected); }
static void Main(string[] args) { string pathMap = @"mapaAlfa.txt"; Dictionary <char, int> map = null; InputMapperService maperService = null; //creando dependencias necesarias IWriterService writerService = new ConsoleWriterService(); writerService.inicializacion(); IReaderService readerService = new ConsoleReaderService(); ILogger logger = new Logger(); IMapService mapGen = new MapService(new StringService(), new FileService()); try { map = mapGen.getMap(pathMap); maperService = new InputMapperService(map); } catch (ExpectedException me) { writerService.notificarError("Ocurrio un error - Dirijase a './log' para obtener mas detalles", me); logger.registrarErrorAsync("Ocurrio un error ", me); if (me.isCritical()) { Environment.Exit(-1); } } catch (Exception ex) { writerService.notificarErrorInesperado("Ocurrio un error inesperado - Dirijase a './log' para obtener mas detalles", ex); logger.registrarErrorInesperadoAsync("Ocurrio un error inesperado", ex); Environment.Exit(-1); } //fin inicializacion de dependencias writerService.finInicializacion(); APP app = new APP(logger, maperService, readerService, writerService); app.ejecutar(); }