Ejemplo n.º 1
0
        public void NumberArgument_can_parse_valid_numbers(string value, string integerPart, string fractionalPart, bool isNegative, bool isNeutral)
        {
            var number = NumberArgument.Parse(value);

            Assert.Equal(value, number.Original);
            Assert.Equal(fractionalPart, number.FractionalPart);
            Assert.Equal(integerPart, number.IntegerPart);
            Assert.Equal(isNegative, number.IsNegative);
            Assert.Equal(isNeutral, number.IsNeutral);
        }
Ejemplo n.º 2
0
 public void NumberArgument_throws_argument_exception_while_parse_invalid_numbers(string value)
 {
     Assert.Throws <ArgumentException>(() => NumberArgument.Parse(value));
 }
Ejemplo n.º 3
0
        void doClick()
        {
            RaycastHit hit;
            Vector3    position  = transform.position + (transform.TransformDirection(Vector3.up) * (erasing ? -.08f : .08f));
            Vector3    direction = transform.TransformDirection(erasing ? Vector3.up : -Vector3.up);

            Debug.DrawRay(position, direction, Color.green, 2, false);

            if (!EditMode)
            {
                if (Physics.Raycast(position, direction, out hit, 100.0F)) //tk might need to adjust the  parameters on this raycast
                {
                    Debug.Log((erasing ? "Erasing " : "Clicking") + GetGameObjectPath(hit.collider.gameObject.transform));
                    Button btn = findParentWith <Button>(hit.collider.gameObject);

                    if (btn != null)
                    {
                        CurrentButton = btn;
                        btn.onClick.Invoke();
                    }
                    else
                    {
                        Debug.Log("No Button available");
                    }
                }
                else
                {
                    Debug.Log("No hit in frame mode");
                }
            }
            else //EditMode
            {
                if (Physics.Raycast(position, direction, out hit, 100.0F))
                {
                    Debug.Log((erasing ? "Erasing " : "Clicking") + GetGameObjectPath(hit.collider.gameObject.transform));
                    if (draggingStatement is null)
                    {
                        NumberArgument na = findParentWith <NumberArgument>(hit.collider.gameObject);
                        if (!(na is null))
                        {
                            na.Select();
                        }
                        ASTNodeMono mononode = findParentWith <ASTNodeMono>(hit.collider.gameObject);
                        if (!(mononode is null))
                        {
                            Method    m = mononode.ContainingMethod();
                            Statement s = mononode.ContainingStatement();
                            if (!(s is null))
                            {
                                Debug.Log("StatementEdit");
                                if (!erasing)
                                {
                                    Debug.Log("MethodEdit");
                                }
                                else
                                {
                                    s.RemoveSelf();
                                    Destroy(s.gameObject);
                                }
                            }
                            else if (!(m is null))
                            {
                                Debug.Log("MethodEdit");
                                //no method edits available
                                //m.AcceptStatement(s);
                            }
                        }
                    }