예제 #1
0
        public void TestPosts()
        {
            bool error = false;

            try
            {
                ISplitService    convierte  = new SplitService();
                StringCollection collection = new StringCollection()
                {
                    "andrea",
                    "marte",
                    "guspy",
                    "jesucristoplanet"
                };

                List <Rebelde> listaRebeldes = new RebeldeFactory(convierte).ListRebeldes(collection);
                ILog           log           = new Log();
                log.CrearLog(listaRebeldes);
            }
            catch (Exception e)
            {
                error = true;
                _logger.LogError(e.Message);
            }


            Assert.IsFalse(error);
        }
        public SplitServiceTest()
        {
            ValidString   = "Alberto,Zaragoza";
            InvalidString = "Alberto-Zaragoza";
            _delimiter    = ',';

            _split = new SplitService();
        }
예제 #3
0
        public void BadStringToArray()
        {
            _invalidCollection = "xed";
            _simbol            = ',';
            _split             = new SplitService();

            Assert.Throws <SplitException>(() => _split.Convert(_invalidCollection, _simbol));
        }
예제 #4
0
        private void Main_Load(object sender, EventArgs e)
        {
            var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "PaystubSplitAndProtect");

            _settingsService = new SettingsService(path);
            //Could wire up a DI container...or just not and say we did
            _splitService = new SplitService(_settingsService);

            this.Text = "Paystub Split and Protect V1.0.1";
        }
예제 #5
0
        public void StringToArray()
        {
            _invalidCollection = "abc";
            _validCollection   = "Darius, Jupiter";
            _simbol            = ',';
            _split             = new SplitService();

            var result = _split.Convert(_validCollection, _simbol);

            Assert.AreEqual(2, result.Length);
        }
예제 #6
0
        static void Main(string[] args)
        {
            SplitService SplS = new SplitService();

            string path = "C:\\Mafell\\";

            string[] fileEntries;


            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            if (Directory.Exists(path))
            {
                // This path is a directory
                fileEntries = ProcessDirectory(path);


                foreach (string fileName in fileEntries)
                {
                    string Akte = "";
                    if (!String.IsNullOrEmpty(fileName))
                    {
                        Akte = fileName.Substring(fileName.IndexOf('-') + 1, fileName.IndexOf(')') - fileName.IndexOf('-'));
                    }

                    if (!String.IsNullOrEmpty(Akte) && Directory.Exists(path + Akte))
                    {
                        DeleteDirectory(path + Akte);
                        Directory.CreateDirectory(path + Akte);
                    }
                    if (!String.IsNullOrEmpty(Akte) && !Directory.Exists(path + Akte))
                    {
                        Directory.CreateDirectory(path + Akte);
                    }


                    //string fileName = "C:\\Questel\\Transformed\\Bookmarks\\Überwachungsmitteilung-109(69)-KW25-2020.pdf";

                    Dictionary <int, int> dict = SplS.GetBookmarkList(fileName);

                    SplS.SplitPDFByBookMark(fileName, dict, Akte);
                }
            }
        }
예제 #7
0
        public IActionResult Post(StringCollection collection)
        {
            ISplitService splitService = new SplitService();

            try
            {
                var  listaRebeldes = new RebeldeFactory(splitService).ListRebeldes(collection);
                ILog log           = new Log();
                log.CrearLog(listaRebeldes);
                return(Ok(listaRebeldes));
            }
            catch (Exception e)
            {
                _logger.LogError(e.Message);
                return(StatusCode(500));
            }
        }
예제 #8
0
        public List <Rebelde> GetListaRebeldes()
        {
            ISplitService splitService = new SplitService();

            try
            {
                var lsitaRebeldes = new RebeldeFactory(splitService);
                if (lsitaRebeldes.ToString().Equals(" "))
                {
                    throw new RepositoryException("lista vacia");
                }
                return(new List <Rebelde>());
            }
            catch (RepositoryException ex)
            {
                throw new ServiceException("Error en GetListaRebeldes()", ex);
            }
        }
        public void SplitSuperPoweredIntoGroupsTest()
        {
            var mockDataAccess       = Mocks.Stub <IRepository <string> >();
            var mockServiceRead      = Mocks.Stub <IServiceRead>();
            var mockAppConfiguration = Mocks.Stub <IAppConfiguration>();
            var serviceSplit         = new SplitService(mockDataAccess, mockServiceRead, mockAppConfiguration);

            using (Mocks.Record())
            {
                SetupResult.For(mockAppConfiguration.GetRuleForVillains()).Return("");
                SetupResult.For(mockServiceRead.GetAllSuperPoweredEntities()).Return(GetFake <Person>(3));
                SetupResult.For(mockServiceRead.GetSuperHeroes()).Return(GetFake <Person>(5));
                SetupResult.For(mockServiceRead.GetVillains()).Return(GetFake <Person>(10));
            }

            serviceSplit.SplitSuperPoweredIntoGroups();
            Assert.IsTrue(true);
        }