Exemple #1
0
        public CarregarMapaResponse LoadMapaFromFile(CarregarMapaRequest request)
        {
            var response = new CarregarMapaResponse();

            try
            {
                var result = _mapaFileRepository.FindBy(request.Arquivo, request.NomeMapa);
                if (result != null)
                {
                    response.Mapa    = result;
                    response.Success = true;
                    response.Message = Resources.FileServices_LoadMapaFromFile_Success_Message;
                }
                else
                {
                    response.Success = false;
                    response.Message = Resources.FileServices_LoadMapaFromFile_Fail_Message;
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.Message = Resources.FileServices_LoadMapaFromFile_Error_Message + ex.Message;
            }
            return(response);
        }
Exemple #2
0
        public void Test2_Persisting_ClientExampleFile_Will_Pass()
        {
            var nomeMapa = "MyMap";

            var request = new CarregarMapaRequest()
            {
                NomeMapa = nomeMapa,
                Arquivo  = this._fileName
            };

            var response = this._fileServices.LoadMapaFromFile(request);

            var mapa = response.Mapa.ConvertToMapa();
        }
Exemple #3
0
        public void Test1_Loading_ClientExampleFile_Will_Pass()
        {
            var nomeMapa = "MyMap";

            var request = new CarregarMapaRequest()
            {
                NomeMapa = nomeMapa,
                Arquivo  = this._fileName
            };

            var response = this._fileServices.LoadMapaFromFile(request);

            var mapa = response.Mapa.ConvertToMapa();

            foreach (var rota in mapa.Rotas)
            {
                Console.WriteLine("{0} -> {1} = {2}", rota.Origem, rota.Destino, rota.Custo);
            }

            Assert.IsTrue(mapa.NomeMapa.Equals(nomeMapa));
            Assert.IsTrue(mapa.Rotas.Count == 6);
        }