Beispiel #1
0
        public void ArchivoNuevoVacio()
        
        {
            Archivo arch = new Archivo();

            Assert.IsTrue(arch.DocumentoActual != null);
            Assert.IsTrue(string.IsNullOrEmpty(arch.DocumentoActual.Text));

        }
Beispiel #2
0
        public void ArchivosDiferentes3()
        {
            Archivo arch1 = new Archivo();
            object arch2 = new object();

            arch1.DocumentoActual.Text = "hola";

            arch1.Ubicacion = Path.Combine(Path.GetTempPath(), "prueba1.gar");

            Assert.IsFalse(arch1.Equals(arch2));

        }
Beispiel #3
0
        public void ArchivosIguales()
        {
            Archivo arch1 = new Archivo();
            Archivo arch2 = new Archivo();

            arch1.DocumentoActual.Text = "hola";
            arch2.DocumentoActual.Text = "hola";

            arch1.Ubicacion = Path.Combine(Path.GetTempPath(), "prueba.gar");
            arch2.Ubicacion = Path.Combine(Path.GetTempPath(), "prueba.gar");

            Assert.IsTrue(arch1.Equals(arch2));

        }
Beispiel #4
0
        public void NombreVacioCorrecto()
        {
            Archivo arch1 = new Archivo();

            Assert.IsTrue(arch1.Nombre.Equals(string.Empty));

        }
Beispiel #5
0
        public void NombreCorrecto()
        {
            string filename = Path.GetRandomFileName();
            Archivo arch1 = new Archivo();
            arch1.Ubicacion = Path.Combine(Path.GetTempPath(), filename);

            Assert.IsTrue(arch1.Nombre.Equals(filename));

        }
Beispiel #6
0
        public void TemplateAsignadoCorrecto()
        {
            Archivo arch1 = new Archivo();
            arch1.AsignarTemplate();
            Assert.IsTrue(arch1.DocumentoActual.Text.Equals(Archivo.TEMPLATE));


        }
Beispiel #7
0
        public void New()
        {
            bool permitirNuevo = true;
            if (!ArchivoActual.TextoActualGuardado)
            {
                permitirNuevo = servicioMessageBox.ShowMessageWithOptions("Esta seguro?", "hola");
            }

            if (permitirNuevo)
            {
                ArchivoActual = new Archivo();
                ListaMensajesCompilacion.Clear();
                RaisePropertyChanged("CompilacionCorrecta");
            }
        }
Beispiel #8
0
        public MainViewModel(IMessageBoxService servMsgBox, IFileManagerDialogService servFileManager,
            IProcessStarterService servProcess, IPrinterService servImpr)
        {
            ////if (IsInDesignMode)
            ////{
            ////    // Code runs in Blend --> create design time data.
            ////}
            ////else
            ////{
            ////    // Code runs "for real"
            ////}

            
            ArchivoActual = new Archivo();            
            ListaMensajesCompilacion = new ObservableCollection<MensajeCompilacion>();

            
            CommandNew = new RelayCommand(New);
            CommandOpen = new RelayCommand(Open);
            CommandSave = new RelayCommand(Save);
            CommandSaveAs = new RelayCommand(SaveAs);
            CommandPrint = new RelayCommand(Print);
            CommandExit = new RelayCommand(Exit);


            CommandCompilar = new RelayCommand(Compilar);
            CommandEjecutar = new RelayCommand(Ejecutar);

            CommandAbrirManual = new RelayCommand(AbrirManual);
            CommandAboutUs = new RelayCommand(AboutUs);


            servicioMessageBox = servMsgBox;
            servicioFileManager = servFileManager;
            servicioImpresion = servImpr;
            servicioProcesos = servProcess;

            compilador = new Compilador();
        }
Beispiel #9
0
        public void ImpresionNulleada()
        {
            Archivo arch = new Archivo();
            arch.Ubicacion = Path.Combine(Path.GetTempPath(), Path.GetTempFileName());
            arch.DocumentoActual.Text = "que tal buenos dias";

            MainViewModel vm = new MainViewModel(null, null, null,
                ArmarPrinterChooserService(null, arch.Nombre, arch.DocumentoActual.Text).Object);

            vm.Print();
        }
Beispiel #10
0
        static internal Archivo AbrirDeDisco(string path)
        {
            Archivo arch = null;
            if (File.Exists(path))
            {
                using (StreamReader strReader = File.OpenText(path))
                {
                    arch = new Archivo();
                    arch.DocumentoActual.Text = strReader.ReadToEnd();
                    arch.Ubicacion = path;
                }


            }
            return arch;
        }
Beispiel #11
0
        public object Clone()
        {
            Archivo arch = new Archivo();
            arch.DocumentoActual = new TextDocument();
            arch.DocumentoActual.Text = DocumentoActual.Text;

            arch.Ubicacion = Ubicacion;

            return arch;
        }