Ejemplo n.º 1
0
        public void ExecuteTests()
        {
            IMCollection <Action> testMethods = Tests();

            if (Predefined.IsEmpty(testMethods))
            {
                _logger.Log("[IGNORED] " + this + " There are no tests to be executed here...");
                return;
            }

            if (IgnoreSuite())
            {
                _logger.Log("[IGNORED] " + this + " This suite is marked to be ignored");
                return;
            }

            testMethods.ForEach(testMethod => {
                try
                {
                    SetUp();
                    testMethod();
                    OnSucceedTest(testMethod);
                }
                catch (Exception e)
                {
                    OnFailedTest(testMethod);
                    _logger.Error(e.Message);
                }
                CleanUp();
            });
        }
Ejemplo n.º 2
0
        public StarfieldObject(Texture2D tex, Vector2 start, float vel, float scl, Predefined def)
        {
            texture  = tex;
            position = start;
            velocity = vel;
            scale    = scl;

            if (def == Predefined.SmallStar)
            {
                spriteOffsetX = 1;
                spriteOffsetY = 1;
                spriteWidth   = 1;
                spriteHeight  = 1;
            }
            else if (def == Predefined.PointedStar)
            {
                spriteOffsetX = 6;
                spriteOffsetY = 1;
                spriteWidth   = 3;
                spriteHeight  = 3;
            }
            else if (def == Predefined.Planet)
            {
                spriteOffsetX = 51;
                spriteOffsetY = 682;
                spriteWidth   = 151;
                spriteHeight  = 38;
            }
            else if (def == Predefined.Nebula)
            {
                Random rand = new Random();
                int    type = rand.Next(0, 3);

                spriteOffsetX = 10;
                spriteOffsetY = 2;
                spriteWidth   = 32;
                spriteHeight  = 25;

                if (type == 1)
                {
                    spriteOffsetX = 44;
                    spriteOffsetY = 4;
                    spriteWidth   = 23;
                    spriteHeight  = 18;
                }
                else if (type == 2)
                {
                    spriteOffsetX = 70;
                    spriteOffsetY = 2;
                    spriteWidth   = 27;
                    spriteHeight  = 31;
                }

                rotation = rand.Next(0, (int)Math.PI * 2);
            }
        }
Ejemplo n.º 3
0
        public void PredifinedItems()
        {
            Predefined predefined            = new Predefined();
            IEnumerable <ShoppingItem> items = predefined.GetAllItems();

            ShoppingItem bread  = items.First(f => f.Code == "BRD");
            ShoppingItem apple  = items.First(f => f.Code == "APL");
            ShoppingItem banana = items.First(f => f.Code == "BNA");

            Assert.AreEqual("Bread", bread.Name, "This item should a bread");
            Assert.AreEqual("Apple", apple.Name, "This item should an apple");
            Assert.AreEqual("Banana", banana.Name, "This item should a banana");
        }
Ejemplo n.º 4
0
        public KeysController()
        {
            TatePairing        e             = Predefined.ssTate();
            BigInt             s             = new BigInt("505589879806357574715819689796588537146433291440", 10);
            BFMasterPrivateKey masterPrivate = new BFMasterPrivateKey(s);
            BigInt             xP            = new BigInt("4291662186182105785020055031256275922735182686564035226466395653970413755358824903482223509624549595190077490704367257937172972896431165061643256253841639", 10);
            BigInt             yP            = new BigInt("4734655302033019638724717069550998600270840147458147624263679086394750166097273830456518097912007100893265204858608788227968249694875877762941090121639110", 10);
            BigInt             xPpub         = new BigInt("3321521420324942690122656396767763795495870232445101779865981146134484022298665464121724898190544088107820667943606314446170142017782563402275554873870099", 10);
            BigInt             yPpub         = new BigInt("5811060153287472925206265749794945978469077668029247862550354611572579518279518356217273453987945241447730233617290283194068671621572534510817890943208269", 10);
            Point             P            = new Point(xP, yP);
            Point             Ppub         = new Point(xPpub, yPpub);
            BFMasterPublicKey masterPublic = new BFMasterPublicKey(e, P, Ppub);

            master = new KeyPair(masterPublic, masterPrivate);
        }
Ejemplo n.º 5
0
        public void BillinearTest()
        {
            //using a predefined pairing
            Pairing e = Predefined.nssTate();

            //get P, which is a random point in group G1
            BigInt xP = new BigInt("6489939838247988945871981900040296813593014269345452667904622838482534881503698483366430292883248221510827517646942621360563883893977498988822397615847035", 10);
            BigInt yP = new BigInt("4183869719038127850866054323652097154062917818644838834002147757841525900395398794914246812190615424669832349278263049648914095684913634131502517423626958", 10);
            Point P = new Point(xP, yP);

            //get Q, which is a random point in group G2
            BigInt xQ = new BigInt("2954273822533893703877488768696651085799471510788466547935020721095428933759242911655447662730930250257332528194261492443088328780492269310876627460775540", 10);
            BigInt yQ = new BigInt("5618108911398484778214611016375606480759218944436047801309324726445485710683489022960503194997792712985027904009701406998265308597942813750269945637462064", 10);
            Point Q = new Point(xQ, yQ);

            //compute e(P,Q)
            FieldElement epq = e.Compute(P, Q);

            //the curve on which G1 is defined
            EllipticCurve g1 = e.Curve;
            //a is a 160-bit random integer
            BigInt a = new BigInt(160, new Random());
            //Point aP is computed over G1
            Point aP = g1.Multiply(P, a);

            //The curve on which G2 is defined
            EllipticCurve g2 = e.Curve2;
            //b is a 160-bit random integer
            BigInt b = new BigInt(160, new Random());
            //bQ is computed over G2
            Point bQ = g2.Multiply(Q, b);

            //compute e(aP,bQ)
            FieldElement res = e.Compute(aP, bQ);

            //compute e(P,Q)^ab, this is done in group Gt
            BigInt ab = a.Multiply(b);
            //get the field on which Gt is defined
            Field gt = e.Gt;
            FieldElement res2 = gt.Pow(epq, ab);

            //compare these two
            Assert.AreEqual(res, res2);
        }
        static void Main(string[] args)
        {
            Predefined p = new Predefined();

            ParkingLot park = new ParkingLot();
            Floors     fl   = p.IniatializeFloors();

            park.floors.Add(fl);


            Customer cust;
            Admin    admin;


            while (1 == 1)
            {
                Console.WriteLine(" ADMIN PRESS 1 ");
                Console.WriteLine(" CUSTOMER PRESS 2 ");

                int choice = Convert.ToInt32(Console.ReadLine());

                //Create a few Vehicle and User Class


                if (choice == 2)
                {
                    cust = p.InitializeCustomers();
                    cust.search.ShowParkingSpaceByVehicleType(cust.v, park);
                }
                else
                {
                    admin = p.InitializeAdmin();

                    foreach (var x in p.IniatializeParkingSpot())
                    {
                        admin.AddParkingSpot(park.floors[0], x);
                    }
                }
            }
        }
Ejemplo n.º 7
0
        public IMCollection <TEntity> Transform()
        {
            IMCollection <TEntity> resultObjects = new MCollection <TEntity>();

            _dbRows.ForEach(row =>
            {
                TEntity entity = new TEntity();

                row.Columns.ForEach(column =>
                {
                    string columnName = column.Name?.ToLower();

                    if (column.Value == DBNull.Value)
                    {
                        return;
                    }

                    if (Predefined.Like(columnName, "%_id"))
                    {
                        //Getting relationship instance
                        PropertyInfo entityRelationshipInfo = GetPrivatePropertyInfo(typeof(TEntity), columnName?.Split("_id")[0]);
                        object entityRelationshipInstance   = entityRelationshipInfo.GetValue(entity);

                        //Setting up relationship id
                        PropertyInfo entityRelationshipIdInfo = GetPrivatePropertyInfo(entityRelationshipInstance.GetType(), "id");
                        entityRelationshipIdInfo?.SetValue(entityRelationshipInstance, Convert.ChangeType(column.Value, column.Type));
                    }
                    else
                    {
                        columnName = columnName?.Replace("_", "");
                        PropertyInfo propertyInfo = GetPrivatePropertyInfo(typeof(TEntity), columnName);
                        propertyInfo?.SetValue(entity, Convert.ChangeType(column.Value, column.Type));
                    }
                });

                resultObjects.Add(entity);
            });

            return(resultObjects);
        }
Ejemplo n.º 8
0
 public int CompareTo(Predefined other)
 {
     return(Value.CompareTo(other));
 }
Ejemplo n.º 9
0
 public static NodeID make_nid(Predefined predefined)
 {
     return((UInt16)predefined);
 }
 private static ClientInput AddDefaultPermissions(ClientInput c)
 {
     c.Permissions = c.Permissions.Concat(Predefined.ClientDefaults()).Distinct().ToList();
     return(c);
 }