Пример #1
0
 [Test] public void ParseExceptionIsRecorded() {
     var service = new Service.Service();
     const string tables = "<table>garbage</table>";
     RunTest(service, tables);
     Assert.IsTrue(resultTables.Contains("class=\"error\""), resultTables);
     Assert.IsTrue(resultTables.Contains("Unable to parse input. Input ignored."), resultTables);
 }
Пример #2
0
 [Test] public void StoryTestIsExecuted() {
     var service = new Service.Service();
     service.AddNamespace("fitlibrary");
     service.ApplicationUnderTest.AddAssembly("fit.dll");
     RunTest(service, "<table><tr><td>do</td></tr></table><table><tr><td>do</td></tr></table>");
     Assert.AreEqual("<table><tr><td><span class=\"fit_interpreter\">do</span></td></tr></table><table><tr><td><span class=\"fit_interpreter\">do</span></td></tr></table>", resultTables);
 }
 private static void CheckRoundTrip(string input)
 {
     var service = new Service.Service();
     var source = (Parse)service.Compose(new StoryTestString(input));
     var result = service.Parse(typeof(StoryTestString), TypedValue.Void, source);
     Assert.AreEqual(input, result.ValueString);
 }
Пример #4
0
 static string ProcessRequest(string request, Memory memory) {
     if (request == exitRequest) return exitReply;
     var service = new Service.Service(memory);
     var writer = new StoryTestStringWriter(service);
     var storyTest = new StoryTest(service, writer).WithInput("test@\n" + request);
     storyTest.Execute();
     return writer.Tables;
 }
Пример #5
0
 [Test] public void CellIsMadeWithEmbeddedTable() {
     var service = new Service.Service();
     Parse table =
         Parse.ParseFrom("<table><tr><td>11</td><td>12</td></tr><tr><td>21</td><td>22</td></tr></table>");
     var cell = (Parse) service.Compose(new ParseTable(table));
     Assert.AreEqual("\n<td>\n<table>\n<tr>\n<td><span class=\"fit_grey\">11</span></td>\n<td><span class=\"fit_grey\">12</span></td></tr>" +
     "\n<tr>\n<td><span class=\"fit_grey\">21</span></td>\n<td><span class=\"fit_grey\">22</span></td></tr></table></td>", cell.ToString());
 }
Пример #6
0
 public void StoryTestIsExecuted()
 {
     var service = new Service.Service();
     service.AddNamespace("fitlibrary");
     service.ApplicationUnderTest.AddAssembly("fit.dll");
     const string tables = "<table><tr><td>do</td></tr></table><table><tr><td>do</td></tr></table>";
     RunTest(service, tables);
     Assert.AreEqual(tables, resultTables);
 }
 [Test] public void HtmlStringIsParsed() {
     var service = new Service.Service();
     Tree<Cell> result = service.Compose(new StoryTestString("<table><tr><td>hello</td></tr></table>"));
     var table = ((Parse)result).Parts;
     Assert.AreEqual("<table>", table.Tag);
     Parse cell = table.Parts.Parts;
     Assert.AreEqual("<td>", cell.Tag);
     Assert.AreEqual("hello", cell.Body);
 }
Пример #8
0
 public void TestInvoke()
 {
     FixtureWithExecutableMethod.Calls = 0;
     Parse cell = TestUtils.CreateCell("do");
     service = new Service.Service();
     var fixture = new FixtureWithExecutableMethod {Processor = service};
     fixture.Processor.Execute(fixture, new CellRange(cell, 1), new CellTree());
     Assert.AreEqual(1, FixtureWithExecutableMethod.Calls);
 }
Пример #9
0
        TypedValue Parse(string inputTables, TypedValue target)
        {
            processor = new Service.Service();
            processor.ApplicationUnderTest.AddAssembly(Assembly.GetExecutingAssembly().CodeBase);
            processor.ApplicationUnderTest.AddNamespace(typeof(SampleDomain).Namespace);
            var parser = new ParseInterpreter {
                Processor = processor
            };
            var table = fit.Parse.ParseFrom(inputTables);

            return(parser.Parse(typeof(Interpreter), target, table.Parts));
        }
Пример #10
0
        public void TestInvoke()
        {
            FixtureWithExecutableMethod.Calls = 0;
            Parse cell = TestUtils.CreateCell("do");

            service = new Service.Service();
            var fixture = new FixtureWithExecutableMethod {
                Processor = service
            };

            fixture.CellOperation.TryInvoke(fixture, new CellRange(cell, 1));
            Assert.AreEqual(1, FixtureWithExecutableMethod.Calls);
        }
Пример #11
0
        static string ProcessRequest(string request, Memory memory)
        {
            if (request == exitRequest)
            {
                return(exitReply);
            }
            var service   = new Service.Service(memory);
            var writer    = new StoryTestStringWriter(service);
            var storyTest = new StoryTest(service, writer).WithInput("test@\n" + request);

            storyTest.Execute();
            return(writer.Tables);
        }
Пример #12
0
 public void ParseExceptionIsRecorded()
 {
     var service = new Service.Service();
     const string tables = "<table>garbage</table>";
     var socket = new TestSocket();
     socket.PutByteString("0000000022");
     socket.PutByteString(tables);
     socket.PutByteString("0000000000");
     var server = new SocketServer(new FitSocket(socket, new NullReporter()), service, new NullReporter(), false);
     server.ProcessTestDocuments(new StoryTestStringWriter(service).ForTables(s => resultTables += s));
     Assert.IsTrue(resultTables.Contains("class=\"error\""), resultTables);
     Assert.IsTrue(resultTables.Contains("Unable to parse input. Input ignored."), resultTables);
 }
Пример #13
0
 public void StoryTestIsExecuted()
 {
     var service = new Service.Service();
     service.AddNamespace("fitlibrary");
     service.ApplicationUnderTest.AddAssembly("fit.dll");
     const string tables = "<table><tr><td>do</td></tr></table><table><tr><td>do</td></tr></table>";
     var socket = new TestSocket();
     socket.PutByteString("0000000070");
     socket.PutByteString(tables);
     socket.PutByteString("0000000000");
     var server = new SocketServer(new FitSocket(socket, new NullReporter()), service, new NullReporter(), false);
     server.ProcessTestDocuments(new StoryTestStringWriter(service).ForTables(s => resultTables += s));
     Assert.AreEqual(tables, resultTables);
 }
Пример #14
0
        public async Task <List <ProductsGeneral> > GetListProducts()
        {
            try {
                Service.Service serv = new Service.Service();
                ListProducts = await serv.AllProducts();

                Console.WriteLine("Todos los productos Obtenidos-========>" + ListProducts.Count);
                return(ListProducts);
            } catch (Exception ex) {
                Console.WriteLine("No se pudieron obtner los productos");
                Console.WriteLine("Unexpected Error--->> {0}", ex);
            }
            return(null);
        }
Пример #15
0
        async Task <bool> readyAsync()
        {
            try {
                Service.Service servicio = new Service.Service();

                listPlanes = await servicio.PlansAsync();

                Console.WriteLine("Lista de planes: " + listPlanes.Count);

                return(true);
            }
            catch {
                return(false);
            }
        }
Пример #16
0
        [Test] public void ParseExceptionIsRecorded()
        {
            var          service = new Service.Service();
            const string tables  = "<table>garbage</table>";
            var          socket  = new TestSocket();

            socket.PutByteString("0000000022");
            socket.PutByteString(tables);
            socket.PutByteString("0000000000");
            var server = new SocketServer(new FitSocket(socket, new NullReporter()), service, new NullReporter(), false);

            server.ProcessTestDocuments(WriteResult);
            Assert.IsTrue(resultTables.Contains("class=\"error\""), resultTables);
            Assert.IsTrue(resultTables.Contains("Unable to parse input. Input ignored."), resultTables);
        }
        public void TestLoadHandler()
        {
            var configuration = TestUtils.InitAssembliesAndNamespaces();
            var builder       = new TestBuilder();

            builder.Append("<table>");
            builder.Append("<tr><td colspan=\"2\">cell handler loader</td></tr>");
            builder.Append("<tr><td>load</td><td>substring handler</td></tr>");
            builder.Append("</table>");
            var service = new Service.Service(configuration);

            Assert.IsFalse(service.Compare(new TypedValue("abc"), TestUtils.CreateCell("..b..")));
            var test = builder.MakeStoryTest(service);

            test.Execute();
            Assert.IsTrue(service.Compare(new TypedValue("abc"), TestUtils.CreateCell("..b..")));
        }
Пример #18
0
        [Test] public void StoryTestIsExecuted()
        {
            var service = new Service.Service();

            service.AddNamespace("fitlibrary");
            service.ApplicationUnderTest.AddAssembly("fit.dll");
            const string tables = "<table><tr><td>do</td></tr></table><table><tr><td>do</td></tr></table>";
            var          socket = new TestSocket();

            socket.PutByteString("0000000070");
            socket.PutByteString(tables);
            socket.PutByteString("0000000000");
            var server = new SocketServer(new FitSocket(socket, new NullReporter()), service, new NullReporter(), false);

            server.ProcessTestDocuments(WriteResult);
            Assert.AreEqual(tables, resultTables);
        }
        public void TestRemoveHandler()
        {
            var configuration = TestUtils.InitAssembliesAndNamespaces();
            var service       = new Service.Service(configuration);

            service.AddOperator(new CompareSubstring());
            var builder = new TestBuilder();

            builder.Append("<table>");
            builder.Append("<tr><td colspan=\"2\">CellHandlerLoader</td></tr>");
            builder.Append("<tr><td>remove</td><td>SubstringHandler</td></tr>");
            builder.Append("</table>");
            Assert.IsTrue(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b..")));
            var test = builder.MakeStoryTest(service);

            test.Execute();
            Assert.IsFalse(new Service.Service(configuration).Compare(new TypedValue("abc"), TestUtils.CreateCell("..b..")));
        }
Пример #20
0
 public ServiceAfter(bool embeded, string path, int port)
 {
     this._runEmbeded = embeded;
     this._path       = path;
     this._port       = port;
     if (embeded)
     {
         _hosting = new Service.Service(path, port);
     }
     else
     {
         _socket           = new Socket(SocketType.Stream, ProtocolType.Tcp);
         _backgroundWorker = new BackgroundWorker {
             WorkerSupportsCancellation = true
         };
         _backgroundWorker.DoWork += _backgroundWorker_DoWork;
     }
 }
Пример #21
0
        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);

            if (!ModelBinders.Binders.ContainsKey(typeof(Model.Model)))
            {
                ModelBinders.Binders.Add(typeof(Model.Model), new MagicModelBuilder());
            }


            var type = ObjectFactory.Create(ControllerName, typeof(Model.Model));

            Check.IsNull(type);
            ModelType = type;

            Service = new Service.Service(ModelType);

            this.PageSize = 20;
        }
Пример #22
0
        private void ExecutePage(StoryPageName pageName, StoryTestString input, Action<StoryTestString, TestCounts> handleResults,
	                             Action handleNoTest)
        {
            var service = new Service.Service(configuration);
            Tree<Cell> result = service.Compose(input);
            if (result == null) {
                handleNoTest();
                return;
            }
            var storyTest = new StoryTest((Parse) result.Value,
                                          (tables, counts) =>
                                          handleResults(service.ParseTree<Cell, StoryTestString>(tables), counts));
            if (pageName.IsSuitePage) {
                storyTest.ExecuteOnConfiguration(configuration);
            }
            else {
                storyTest.Execute(configuration);
            }
        }
Пример #23
0
            public void Do(StoryTestPage page)
            {
                var elapsedTime = new ElapsedTime();
                var input       = page.TestContent;

                if (string.IsNullOrEmpty(input))
                {
                    page.WriteNonTest();
                    DoNoTest();
                }

                StoreCurrentlyExecutingPagePath(page.Name.Name);

                var service   = new Service.Service(memory);
                var writer    = new StoryTestStringWriter(service);
                var storyTest = new StoryTest(service, writer).WithInput(input);

                if (!storyTest.IsExecutable)
                {
                    page.WriteNonTest();
                    DoNoTest();
                    return;
                }

                storyTest.OnAbandonSuite(() => { SuiteIsAbandoned = true; });

                if (page.Name.IsSuitePage)
                {
                    storyTest.Execute();
                }
                else
                {
                    storyTest.Execute(new Service.Service(service));
                }

                var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime);

                page.WriteTest(pageResult);
                handleCounts(writer.Counts);
                resultWriter.WritePageResult(pageResult);
            }
Пример #24
0
        public async override void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            try {
                Service.Service servicio  = new Service.Service();
                var             documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

                if (File.Exists(documents + "/allItems.json") == false)
                {
                    var  ok = File.Exists(documents + "/allItems.json");
                    long ll = tx.Length;

                    Console.WriteLine("Peso de archivo " + ll + " " + ok);
                }
                if (File.Exists(documents + "/allItems.json"))
                {
                    tx = System.IO.File.ReadAllText(documents + "/allItems.json");//Aun falta validar que el archivo exista en la carpeta

                    if (lstProducto == null)
                    {
                        lstProducto = servicio.serializeStringJson(tx);
                    }
                }
            } catch (Exception e) {
                Console.WriteLine(e);
                var sessioErrorAlert = UIAlertController.Create("No hay datos locales", "Presione el boton actualizar, para descargar localmente", UIAlertControllerStyle.Alert);

                sessioErrorAlert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null));
                PresentViewController(sessioErrorAlert, true, null);
            }



            //Console.WriteLine("Cantidad de lstProducto"+ lstProducto.Count);

            //if (await ProductoReadyAsync("a") == true) {
            //	Console.WriteLine("REady async TRUE!");
            //} else {
            //	Console.WriteLine("READY ASYNC false");
            //}
        }
Пример #25
0
        async Task <bool> WaitDataUserAsync()
        {
            Console.WriteLine("WaitHistorialEstadoCuenta Method...");
            try {
                Service.Service serv    = new Service.Service();
                REstado         rEstado = await serv.EstadoCuentaAsync("1", "0", CurrentSession.identificador);


                if (rEstado.codigo == 1000)
                {
                    Console.WriteLine("Session data ready!");
                    Console.WriteLine("Nombre De cliente: " + CurrentSession.nombre_completo);
                    nombreSession.Text = CurrentSession.nombre_completo;
                    numeroSession.Text = CurrentSession.no_telefono;

                    return(true);
                }
                else
                {
                    alert.Title   = "Error de Red";
                    alert.Message = "Verifique su conexión a internet";
                    alert.AddButton("OK");
                    alert.Show();
                    Console.WriteLine("Session data error!");

                    return(false);
                }
            }
            catch {
                alert.Title   = "Error de Red";
                alert.Message = "Verifique su conexión a internet";
                alert.AddButton("OK");
                alert.Show();
                Console.WriteLine("Session data error!");
            }
            return(false);
        }
Пример #26
0
            public void Do(StoryTestPage page)
            {
                var elapsedTime = new ElapsedTime();
                var input       = page.TestContent;

                if (string.IsNullOrEmpty(input))
                {
                    page.WriteNonTest();
                    DoNoTest();
                }
                var         service = new Service.Service(configuration);
                Tree <Cell> result  = service.Compose(new StoryTestString(input));

                if (result == null || result.Branches.Count == 0)
                {
                    page.WriteNonTest();
                    DoNoTest();
                    return;
                }
                var writer    = new StoryTestStringWriter(service);
                var storyTest = new StoryTest((Parse)result, writer);

                if (page.Name.IsSuitePage)
                {
                    storyTest.ExecuteOnConfiguration(configuration);
                }
                else
                {
                    storyTest.Execute(configuration);
                }
                var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime);

                page.WriteTest(pageResult);
                handleCounts(writer.Counts);
                resultWriter.WritePageResult(pageResult);
            }
Пример #27
0
        private void ExecutePage(StoryPageName pageName, StoryTestString input, Action <StoryTestString, TestCounts> handleResults,
                                 Action handleNoTest)
        {
            var         service = new Service.Service(configuration);
            Tree <Cell> result  = service.Compose(input);

            if (result == null || result.Branches.Count == 0)
            {
                handleNoTest();
                return;
            }
            var storyTest = new StoryTest((Parse)result,
                                          (tables, counts) =>
                                          handleResults(service.ParseTree <Cell, StoryTestString>(tables), counts));

            if (pageName.IsSuitePage)
            {
                storyTest.ExecuteOnConfiguration(configuration);
            }
            else
            {
                storyTest.Execute(configuration);
            }
        }
 public void NoTablesReturnsNull()
 {
     var service = new Service.Service();
     Tree<Cell> result = service.Compose(new StoryTestString("<b>stuff</b>"));
     Assert.IsNull(result);
 }
Пример #29
0
 public void MakePersonFixture()
 {
     service = new Service.Service();
     personFixture = new PersonFixture { Processor = service };
 }
 public FilterOffersByUser(Service.Service service)
 {
     this.service = service;
 }
Пример #31
0
 public DataStatusJudge(Service.Service service)
 {
     this.service = service;
 }
Пример #32
0
 [Test] public void CellIsMadeWithArray() {
     var service = new Service.Service();
     var cell = (Parse) service.Compose(new [] {"something", "else"});
     Assert.AreEqual("\n<td><span class=\"fit_grey\">something, else</span></td>", cell.ToString());
 }
 public ShowOfferts(Service.Service service)
 {
     this.service = service;
 }
Пример #34
0
        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);

            if (!ModelBinders.Binders.ContainsKey(typeof(Model.Model)))
            {
                ModelBinders.Binders.Add(typeof(Model.Model), new MagicModelBuilder());
            }

            var type = ObjectFactory.Create(ControllerName, typeof(Model.Model));
            Check.IsNull(type);
            ModelType = type;

            Service = new Service.Service(ModelType);

            this.PageSize = 20;
        }
Пример #35
0
 public void Client()
 {
     Service.Service service = new Service.Service();
     service.SaveAudioToFile();
 }
 public HomeController()
 {
     service = Service.Service.Instance;
 }
Пример #37
0
        public ActionResult CreateSemester(string[] semesterId, string[] start, string[] finish)
        {
            Service.Service service = new Service.Service();

            var classes = from c in db.Classes
                           where c.ActiveSchemes.Count < c.Education.Semesters.Count
                           select c;

            foreach (var item in classes)
            {
                List<Semester> semesters = (from s in item.Education.Semesters
                                            select s).ToList();

                int semesterNumber = item.ActiveSchemes.Count;

                service.setNewSemesterForClass(item, semesters[semesterNumber], Convert.ToDateTime(start[semesterNumber]), Convert.ToDateTime(finish[semesterNumber]));
            }

            db.SaveChanges();
            return RedirectToAction("Index");
        }
 private void MakeExceptionFixture()
 {
     service = new Service.Service();
     exceptionFixture = new ExceptionThrowingFixture { Processor = service };
 }
Пример #39
0
 [Test] public void RegularTestUseCopyOfMemory() {
     var service = new Service.Service();
     RunMemoryTest(service, "Regular");
     Assert.IsFalse(service.Memory.HasItem<TestItem>());
 }
Пример #40
0
 public void Do(StoryTestPage page)
 {
     var elapsedTime = new ElapsedTime();
     var input = page.TestContent;
     if (string.IsNullOrEmpty(input)) {
         page.WriteNonTest();
         DoNoTest();
     }
     var service = new Service.Service(configuration);
     Tree<Cell> result = service.Compose(new StoryTestString(input));
     if (result == null || result.Branches.Count == 0) {
         page.WriteNonTest();
         DoNoTest();
         return;
     }
     var writer = new StoryTestStringWriter(service);
     var storyTest = new StoryTest((Parse) result, writer);
     if (page.Name.IsSuitePage) {
         storyTest.ExecuteOnConfiguration(configuration);
     }
     else {
         storyTest.Execute(configuration);
     }
     var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime);
     page.WriteTest(pageResult);
     handleCounts(writer.Counts);
     resultWriter.WritePageResult(pageResult);
 }
 public AddOffer(Service.Service service)
 {
     this.service = service;
 }
Пример #42
0
        static void Main(string[] args)
        {
            var service = new Service.Service(new Model.Model());

            service.Start();
        }
Пример #43
0
 public void SetUp()
 {
     memory = TestUtils.InitAssembliesAndNamespaces();
     storyTables = new TestBuilder("<table><tr><td>" + rowFixtureName + "</td></tr><tr><td>name</td></tr></table>").Parse;
     table = storyTables.Parts;
     NewRowFixtureDerivative.QueryValues.Clear();
     processor = new Service.Service(memory);
 }
Пример #44
0
 [Test] public void SuiteSetUpUpdatesMemory() {
     var service = new Service.Service();
     RunMemoryTest(service, "SuiteSetUp");
     Assert.IsTrue(service.Memory.HasItem<TestItem>());
 }
Пример #45
0
 [Test] public void CellIsMadeWithSimpleString() {
     var service = new Service.Service();
     var cell = (Parse) service.Compose("something");
     Assert.AreEqual("\n<td><span class=\"fit_grey\">something</span></td>", cell.ToString());
 }
Пример #46
0
            public void Do(StoryTestPage page) {
                var elapsedTime = new ElapsedTime();
                var input = page.TestContent;
                if (string.IsNullOrEmpty(input)) {
                    page.WriteNonTest();
                    DoNoTest();
                }

                StoreCurrentlyExecutingPagePath(page.Name.Name);

	            var service = new Service.Service(memory);
                var writer = new StoryTestStringWriter(service);
                var storyTest = new StoryTest(service, writer).WithInput(input);

                if (!storyTest.IsExecutable) {
                    page.WriteNonTest();
                    DoNoTest();
	                return;
	            }

                storyTest.OnAbandonSuite(() => { SuiteIsAbandoned = true; });

                if (page.Name.IsSuitePage) {
                    storyTest.Execute();
                }
                else {
                    storyTest.Execute(new Service.Service(service));
                }

                var pageResult = new PageResult(page.Name.Name, writer.Tables, writer.Counts, elapsedTime);
                page.WriteTest(pageResult);
                handleCounts(writer.Counts);
                resultWriter.WritePageResult(pageResult);
            }
Пример #47
0
 public ProvinceController()
 {
     service = new Service.Service();
 }
Пример #48
0
 public GrpcServer(Service.Service service, Auth auth)
 {
     _service = service;
     _auth    = auth;
 }
 public DeleteOfferts(Service.Service service)
 {
     this.service = service;
 }
 private static void CheckRoundTrip(string input) {
     var service = new Service.Service();
     var source = service.Compose(new StoryTestString(input));
     var result = source.Branches.Aggregate(string.Empty, (current, table) => current + service.Parse(typeof (StoryTableString), TypedValue.Void, table));
     Assert.AreEqual(input, result);
 }
Пример #51
0
 public void MakeStringFixture()
 {
     service = new Service.Service();
     stringFixture = new StringFixture { Processor = service };
 }
 public void NoTablesReturnsEmptyTree()
 {
     var service = new Service.Service();
     Tree<Cell> result = service.Compose(new StoryTestString("<b>stuff</b>"));
     Assert.AreEqual(0, result.Branches.Count);
 }
Пример #53
0
 public void MakeIntFixture()
 {
     service = new Service.Service();
     intFixture = new IntFixture { Processor = service };
 }
Пример #54
0
 public AddEmployeeViewModel(AddEmployeeView addEmployee)
 {
     Service.Service s = new Service.Service();
 }
Пример #55
0
 public UserController()
 {
     service = new Service.Service();
 }
 private void MakeErrorFixture()
 {
     service = new Service.Service();
     fixture = new ErrorThrowingFixture { Processor = service };
 }
Пример #57
0
 private User currentUser; //min simple user manager
 public AccountController()
 {
     service = Service.Service.Instance;
 }