private void Button_Click(object sender, RoutedEventArgs e)
        {
            See sees = new See();

            sees.Show();
            this.Close();
        }
        private void bt_disposeSee_Click(object sender, RoutedEventArgs e)
        {
            if (_DedicatedSee == null)
            {
                System.Windows.MessageBox.Show("SEE already disposed => instanciate first");
                return;
            }

            Cursor Backup = Mouse.OverrideCursor;

            Mouse.OverrideCursor = Cursors.Wait;

            try
            {
                _DedicatedSee.Dispose();

                ToggleOffInsideInformationGroupbox(grid_status_OPCUA);

                _DedicatedSee = null;

                Mouse.OverrideCursor = Backup;
            }
            catch (Exception ex)
            {
                Mouse.OverrideCursor = Backup;

                DisplayException(ex);
            }
        }
Example #3
0
        public void should_return_nfluent_check_based_on_underlying_question_result()
        {
            const long expectedAnswer = 10;
            var        question       = new StubQuestion <long>(expectedAnswer);
            var        jack           = Actor.Named(Names.Jack);

            jack.Should(See.That(question)).IsEqualTo(expectedAnswer);
        }
Example #4
0
        public void should_return_last_http_status_code()
        {
            this.SetupResponse(new HttpResponseBuilder().WithHttpStatusCode(HttpStatusCode.NotFound).Build());

            Actor.AttemptsTo(Get.ResourceAt("api/resource"));

            Actor.Should(See.That(LastResponse.StatusCode())).IsEqualTo(HttpStatusCode.NotFound);
        }
Example #5
0
 public override void VisitSee(See see)
 {
     if (see.Cref != null)
     {
         var cref = _normalizeLink(see.Cref);
         _builder.AppendFormat(" [{0}]({1}) ", cref.Substring(2), cref);
     }
 }
        public void should_return_last_http_headers_by_key()
        {
            var locationHeaderValue = "http://localhost:5000/api/resource/1";

            SetupResponse(new HttpResponseBuilder().WithHeader(HttpHeaders.Location, locationHeaderValue).Build());

            Actor.AttemptsTo(Post.DataAsJson(new { }).To("api/resource"));

            Actor.Should(See.That(LastResponse.Header(HttpHeaders.Location))).IsEqualTo(locationHeaderValue);
        }
Example #7
0
        public void Fetch_user_by_id()
        {
            var jack             = Actor.Named("Jack").WhoCan(CallAnApi.At("https://reqres.in"));
            var expectedResponse = new GetUserByIdResponse(id: 2, name: "fuchsia rose");

            jack.AttemptsTo(FetchUserById(2));

            jack.Should(See.That(LastResponse.Content <GetUserByIdResponse>()))
            .Considering().All.Properties.HasFieldsWithSameValues(expectedResponse);
            jack.Should(See.That(LastResponse.StatusCode())).IsEqualTo(HttpStatusCode.OK);
        }
        /// <summary>
        ///   Visits the <c>see</c> documentation element.
        /// </summary>
        ///
        public override void VisitSee(See see)
        {
            string url  = DistributionManager.GetDocumentationUrl(see.Cref);
            string text = parse(see.Cref, false);

            if (!String.IsNullOrEmpty(see.Content))
            {
                text = see.Content;
            }

            builder.Append(hyperlink(url, text));
        }
Example #9
0
        public void Delete_an_user()
        {
            var jack = Actor.Named("Jack").WhoCan(CallAnApi.At("https://reqres.in"));
            var user = new User {
                Name = "Sarah", Job = "Software Architect"
            };

            jack.AttemptsTo(DeleteAn(user));

            jack.Should(See.That(LastResponse.Content <object>())).IsNull();
            jack.Should(See.That(LastResponse.StatusCode())).IsEqualTo(HttpStatusCode.NoContent);
        }
Example #10
0
        public void Modify_part_of_an_user()
        {
            var jack = Actor.Named("Jack").WhoCan(CallAnApi.At("https://reqres.in"));
            var user = new User {
                Name = "Sarah", Job = "Software Architect"
            };

            jack.AttemptsTo(ModifyPartOf(user));

            jack.Should(See.That(LastResponse.Content <ModifyUserResponse>()))
            .Considering().All.Properties.HasFieldsWithSameValues(user);
            jack.Should(See.That(LastResponse.StatusCode())).IsEqualTo(HttpStatusCode.OK);
        }
        public void should_return_last_http_content()
        {
            var response = "{firstname:'foo', lastname:'bar'}";

            this.SetupResponse(new HttpResponseBuilder().WithContent(response).Build());
            var expectedCustomer = new Customer {
                Firstname = "foo", Lastname = "bar"
            };

            Actor.AttemptsTo(Get.ResourceAt("api/resource"));

            Actor.Should(See.That(LastResponse.Content <Customer>())).HasPropertiesWithSameValues(expectedCustomer);
        }
Example #12
0
        public void should_post_a_person_to_api()
        {
            var jack   = Actor.Named("Jack").WhoCan(CallAnApi.At(_fixture.Host.BaseUrl));
            var person = new CreatePerson {
                Firstname = "Sarah", Lastname = "Ohara"
            };

            jack.AttemptsTo(Post.DataAsJson(person).To("api/People"));
            var resourceLocation = jack.AsksFor(LastResponse.Header(HttpHeaders.Location));

            jack.AttemptsTo(Get.ResourceAt(resourceLocation));

            jack.Should(See.That(LastResponse.Content <Person>()))
            .Considering().All.Properties.HasFieldsWithSameValues(person);
        }
        public void should_return_all_last_http_headers()
        {
            var locationHeaderValue = "http://localhost:5000/api/resource/1";
            var originValue         = "*";

            SetupResponse(new HttpResponseBuilder()
                          .WithHeader(HttpHeaders.Location, locationHeaderValue)
                          .WithHeader(HttpHeaders.AccessControlAllowOrigin, originValue)
                          .Build());

            Actor.AttemptsTo(Get.ResourceAt("api/resource"));

            Actor.Should(See.That(LastResponse.Headers()))
            .ContainsPair(HttpHeaders.Location, new List <string> {
                locationHeaderValue
            })
            .And.ContainsPair(HttpHeaders.AccessControlAllowOrigin, new List <string> {
                originValue
            });
        }
Example #14
0
        public override void VisitSee(See see)
        {
            string cref = see.Cref;

            if (cref.Substring(0, 2).Equals("T:"))
            {
                string typeName = TypeNameUtil.UndecorateTypeName(cref.Substring(2));
                string content  = HtmlEscape(see.Content);
                if (String.IsNullOrEmpty(content))
                {
                    content = HtmlEscape(see.ToText());
                }
                this.Write("[" + content + "]");
                this.Write("(" + typeName + ".md)");
                base.VisitSee(see);
            }
            else
            {
                base.VisitSee(see);
            }
        }
Example #15
0
        public static void Main(string[] args)
        {
            var host = CreateHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var Services = scope.ServiceProvider;
                try
                {
                    var context = Services.GetRequiredService <DataContext>();
                    context.Database.Migrate();
                    See.SeedUbigeos(context);
                }
                catch (Exception ex)
                {
                    var logger = Services.GetRequiredService <ILogger <Program> >();
                    logger.LogError(ex, "Ocurrio un error durante la migracion");
                }
            }

            host.Run();
        }
        public override void VisitSee(See see)
        {
            var content = EncloseInMarks(ExtractLastTokenAndFillGenericParameters((see.Cref ?? see.Content).Trim()));

            if (!_labeledListItem.Any())
            {
                _labeledListItem.Add(new Paragraph(content));
            }
            else
            {
                var paragraph = _labeledListItem.Last() as Paragraph;

                if (paragraph == null)
                {
                    _labeledListItem.Add(new Paragraph(content));
                }
                else
                {
                    paragraph.Add(new TextLiteral(" " + content));
                }
            }
        }
Example #17
0
 /// <summary>
 /// Visits the <c>see</c> documentation element.
 /// </summary>
 public virtual void VisitSee(See see)
 {
     VisitElement(see);
 }
Example #18
0
 public virtual void VisitSee(See see)
 {
 }
        public void should_recall_values_that_previously_remembered()
        {
            actor.Remember(key, value);

            actor.Should(See.That(Remember.ValueOf <long>(key))).IsEqualTo(value);
        }
Example #20
0
 public override void VisitSee(See see)
 {
     base.VisitSee(see);
     if (!string.IsNullOrEmpty(see.Cref))
         builder.Append(see.Cref.Substring(2));
 }
Example #21
0
 public override void VisitSee(See see)
 {
     string cref = see.Cref;
       if (cref.Substring(0, 2).Equals("T:")) {
     string typeName = TypeNameUtil.UndecorateTypeName(cref.Substring(2));
     string content = HtmlEscape(see.Content);
     if (String.IsNullOrEmpty(content)) {
       content = HtmlEscape(see.ToText());
     }
     this.Write("[" + content + "]");
     this.Write("(" + typeName + ".md)");
     base.VisitSee(see);
       } else {
     base.VisitSee(see);
       }
 }
Example #22
0
 public virtual void VisitSee(See see)
 {
 }
Example #23
0
 private string FormatSee(See block)
 {
     return(FormatReferencable(block.Reference));
 }
Example #24
0
 public override void VisitSee(See see)
 {
     //var cref = NormalizeLink(see.Cref);
     //Console.Write(" [{0}]({1}) ", cref.Substring(2), cref);
 }
        private void loadingAndInit()
        {
            Cursor Backup = Mouse.OverrideCursor;

            try
            {
                Mouse.OverrideCursor = Cursors.Wait;

                #region STEP 1 : instanciate your Skill Based Resource Controller (probalby by loading aml files)

                //create or deserialize all the conditions
                SkillBasedResourceController sbrc;
                AMLSkillExecutionEngine      amlSee;
                createSBRC(out sbrc, out amlSee);

                #endregion //STEP 1 : instanciate your Skill Based Resource Controller (probalby by loading aml files)

                #region STEP 2 : instanciate your SEE

                //Instanciate your dedicated See

                if (rb_PopupWindowSee.IsChecked == true)
                {
                    _DedicatedSee = new DedicatedPopUpSee(amlSee, sbrc);
                }
                else
                {
                    if (rb_helloWorldSee.IsChecked == true)
                    {
                        _DedicatedSee = new HelloWorldSee(amlSee, sbrc);
                    }
                    else
                    {
                        _DedicatedSee = new HelloWorldAndQuestionsSee(amlSee, sbrc);
                    }
                }

                #endregion //STEP 2 : instanciate your SEE

                #region optional : check OPC-UA connection

                //check connection of OPC-UA client
                //Wait for licence expired
                Thread.Sleep(250);

                if (_DedicatedSee.OpcUaClient.IsConnected && _DedicatedSee.OpcUaClient.Session.ConnectionStatus != ServerConnectionStatus.LicenseExpired)
                {
                    Action refresh = new Action(() =>
                    {
                        ToggleOnInsideInformationGroupbox(grid_status_OPCUA);
                    });
                    Dispatcher.BeginInvoke(refresh, System.Windows.Threading.DispatcherPriority.Render, null);
                }
                else
                {
                    Action refresh = new Action(() =>
                    {
                        ToggleOffInsideInformationGroupbox(grid_status_OPCUA);
                    });
                    Dispatcher.BeginInvoke(refresh, System.Windows.Threading.DispatcherPriority.Render, null);
                }

                #endregion //optional : check OPC-UA connection

                #region STEP 3 : attach all events to SEE

                subscribeEventsDedicatedSee();

                #endregion //STEP 3: attach all events to SEE

                //Refresh UI with SEE informations
                lbl_seeNodeId.Content      = _DedicatedSee.OpcUaConfiguration.SeeNodeId.ToString();
                lbl_AmsUri.Content         = _DedicatedSee.ConfigurationAms.Uri;
                lbl_OpcuaUrl.Content       = _DedicatedSee.OpcUaConfiguration.ServerUrl;
                lbl_seeId.Content          = _DedicatedSee.SBRC.SeeAmlDescription.ID;
                lbl_seeName.Content        = _DedicatedSee.SBRC.SeeAmlDescription.Name;
                lbl_spacenameIndex.Content = _DedicatedSee.OpcUaConfiguration.SpaceNameIndex;

                //Refresh buttons
                UpdateButtonVisibility();

                //Refresh callable skills
                bt_reloadCallableSkills_Click(null, null);

                Mouse.OverrideCursor = Backup;
            }
            catch (Exception ex)
            {
                Mouse.OverrideCursor = Backup;
                DisplayException(ex);
            }
        }
        /// <summary>
        ///   Visits the <c>see</c> documentation element.
        /// </summary>
        /// 
        public override void VisitSee(See see)
        {
            string url = DistributionManager.GetDocumentationUrl(see.Cref);
            string text = parse(see.Cref, false);

            if (!String.IsNullOrEmpty(see.Content))
                text = see.Content;

            builder.Append(hyperlink(url, text));
        }
 public override void VisitSee(See see)
 {
     if (see.Cref != null) {
         var cref = _normalizeLink(see.Cref);
         _builder.AppendFormat(" [{0}]({1}) ", cref.Substring(2), cref);
     }
 }
Example #28
0
        /// <summary>
        /// Reads all supported documentation elements.
        /// </summary>
        private static IEnumerable<Element> ReadContent(XElement xml)
        {
            foreach (var node in xml.Nodes())
            {
                var element = default(Element);
                switch (node.NodeType)
                {
                    case System.Xml.XmlNodeType.Element:
                        var elementNode = (XElement)node;
                        switch (elementNode.Name.LocalName)
                        {
                            case "summary":
                                element = new Summary(ReadContent(elementNode));
                                break;
                            case "remarks":
                                element = new Remarks(ReadContent(elementNode));
                                break;
                            case "example":
                                element = new Example(ReadContent(elementNode));
                                break;
                            case "para":
                                element = new Para(ReadContent(elementNode));
                                break;
                            case "param":
                                element = new Param(FindAttribute(elementNode, "name"), ReadContent(elementNode));
                                break;
                            case "paramref":
                                element = new ParamRef(FindAttribute(elementNode, "name"));
                                break;
                            case "typeparam":
                                element = new TypeParam(FindAttribute(elementNode, "name"), ReadContent(elementNode));
                                break;
                            case "typeparamref":
                                element = new TypeParamRef(FindAttribute(elementNode, "name"));
                                break;
                            case "code":
                                element = new Code(TrimCode(elementNode.Value));
                                break;
                            case "c":
                                element = new C(elementNode.Value);
                                break;
                            case "see":
                                element = new See(FindAttribute(elementNode, "cref"), FindAttribute(elementNode, "langword"), elementNode.Value, ReadContent(elementNode));
                                break;
                            case "seealso":
                                element = new SeeAlso(FindAttribute(elementNode, "cref"), elementNode.Value, ReadContent(elementNode));
                                break;
                            case "list":
                                element = new List(FindAttribute(elementNode, "type"), ReadContent(elementNode));
                                break;
                            case "listheader":
                                element = new ListHeader(ReadContent(elementNode));
                                break;
                            case "term":
                                element = new Term(ReadContent(elementNode));
                                break;
                            case "description":
                                element = new Description(ReadContent(elementNode));
                                break;
                            case "item":
                                element = new Item(ReadContent(elementNode));
                                break;
                            case "exception":
                                element = new Exception(FindAttribute(elementNode, "cref"), ReadContent(elementNode));
                                break;
                            case "value":
                                element = new Value(ReadContent(elementNode));
                                break;
                            case "returns":
                                element = new Returns(ReadContent(elementNode));
                                break;
                            default:
                                element = new UnknownElement(elementNode, ReadContent(elementNode));
                                break;
                        }
                        break;
                    case System.Xml.XmlNodeType.Text:
                        element = new Text(TrimText(((XText)node).Value));
                        break;
                    default:
                        break;
                }

                if (element != null)
                {
                    element.SetLineInfo(xml as IXmlLineInfo);
                    yield return element;
                }
            }
        }
        /// <summary>
        ///     Parse the next byte in the client data stream
        /// </summary>
        /// <param name="v"></param>
        public void Parse(byte v)
        {
            Console.WriteLine("" + v);
            switch (cs)
            {
            case CS.Waiting:
                if (v == IAC)
                {
                    N("IAC");
                    cs = CS.R_IAC;
                }
                else
                {
                    // assume we're reading a header block
                    header   = null;
                    datatype = 0;
                    datapos  = 1;
                    data[0]  = v;
                    cs       = CS.R_HEADER;
                }
                break;

            case CS.R_HEADER:
                data[datapos] = v;
                datapos++;
                if (datapos == TnHeader.EhSize)
                {
                    header  = new TnHeader(data);
                    datapos = 0;
                    cs      = CS.R_HEADERDATA;
                }
                break;

            case CS.R_HEADERDATA:
                data[datapos] = v;

                if (datapos == 0)
                {
                    Console.WriteLine(See.GetAidFromCode(v));
                }
                if (datapos == 2)
                {
                    Console.WriteLine(Util.DecodeBAddress(data[1], data[2]));
                }

                if (datapos == 3 && data[3] != ControllerConstant.ORDER_SBA)
                {
                    throw new ApplicationException("ni");
                }
                Console.WriteLine("SBA");

                if (datapos == 5)
                {
                    var baddr = Util.DecodeBAddress(data[4], data[5]);
                    Console.WriteLine(BA_TO_COL(baddr) + ", " + BA_TO_ROW(baddr));
                }

                if (datapos > 5)
                {
                    Console.WriteLine(See.GetEbc(Tables.Cg2Ebc[data[datapos]]));
                }


                datapos++;
                break;

            case CS.R_IAC:
                if (v == SB)
                {
                    N("SB");
                    cs       = CS.R_DATA;
                    datatype = v;
                    datapos  = 0;
                }
                else if (v == WILL)
                {
                    N("WILL");
                    cs = CS.R_WILL;
                }
                else
                {
                    NError(v);
                }
                break;

            case CS.R_WILL:
                Console.WriteLine("will " + v);
                cs = CS.Waiting;
                break;

            case CS.R_DATA:
                if (v == IAC)
                {
                    cs = CS.R_IAC_END;
                }
                else
                {
                    data[datapos] = v;
                    datapos++;
                }
                break;

            case CS.R_IAC_END:
                if (v == IAC)
                {
                    data[datapos] = v;
                    datapos++;
                }
                else
                {
                    N("IAC");
                    if (v == SE)
                    {
                        N("SE");
                        N(data, datapos);
                        cs = CS.Waiting;
                    }
                    else
                    {
                        NError(v);
                    }
                }
                break;

            default:
                NError(v);
                break;
            }
        }
Example #30
0
        /// <summary>
        /// See <see cref="Visitor.VisitSee"/>.
        /// </summary>
        public override void VisitSee(See see)
        {
            if (delegates.VisitSee != null)
                delegates.VisitSee(see);

            base.VisitSee(see);
        }