Esempio n. 1
0
 private string GetUniqueName()
 {
     return(GetUniqueString(FRandom.Next(2, 10), true, FExistingDefinitions.Select(x => x.Name).Union(FNewlyInsertedDefinitions.Select(x => x.Name))));
 }
Esempio n. 2
0
 public static FList <Particles.Particle> GenerateListOfParticlesWithRandomVelocity <T>(T particle, int numberOfInputParticles, FRandom Rand) where T : Particle
 {
     return(numberOfInputParticles != 1 ? FList.New(GenerateParticleWithRandomVelocity(particle, Rand), GenerateListOfParticlesWithRandomVelocity(GenerateParticleWithRandomVelocity(particle, FRandom.Next(Rand, 0, 100)), numberOfInputParticles - 1, FRandom.Next(Rand, 0, 100))) : FList.New(GenerateParticleWithRandomVelocity(particle, Rand)));
 }
Esempio n. 3
0
 public static FRandom RandomiseVelocity(FRandom Rand)
 {
     return(FRandom.Next(Rand, Convert.ToInt32(Math.Pow(1, 3)), Convert.ToInt32(Math.Pow(2.9, 8))));
 }
Esempio n. 4
0
        public static Tuple <Photon, Photon> OppositeEjections(Photon P1, Photon P2, FRandom Rand)
        {
            Vector3D v = new Vector3D(Convert.ToDouble(FRandom.Next(Rand, 0, 360).Number), Convert.ToDouble(FRandom.Next(Rand, -90, 90).Number), Convert.ToDouble(FRandom.Next(FRandom.Next(Rand, 0, 360), 0, 360).Number));  // Dirty need to look into for a better solution

            return(new Tuple <Photon, Photon>(new Photon(P1.Wavelength, P1.Frequency, v), new Photon(P2.Wavelength, P2.Frequency, CreateOpposite(v).Item2)));
        }
Esempio n. 5
0
        //Dirty
        public static Tuple <Particle, Particle> OppositeEjections <T> (T P1, T P2, FRandom Rand) where T : Particle
        {
            Vector3D v = new Vector3D(Convert.ToDouble(FRandom.Next(Rand, 0, 360).Number), Convert.ToDouble(FRandom.Next(Rand, -90, 90).Number), Convert.ToDouble(FRandom.Next(FRandom.Next(Rand, 0, 360), 0, 360).Number));  // Dirty need to look into for a better solution

            return(new Tuple <Particle, Particle>((T)Activator.CreateInstance(typeof(T), P1.Velocity, v), (T)Activator.CreateInstance(typeof(T), P2.Velocity, CreateOpposite(v).Item2)));
        }
Esempio n. 6
0
 //Pure
 public static Photon SingularEjection(Photon p, FRandom Rand)  //Overloded function for photons
 {
     return(new Photon(p.Wavelength, p.Frequency, new Vector3D(Convert.ToDouble(FRandom.Next(Rand, 0, 360).Number), Convert.ToDouble(FRandom.Next(Rand, -90, 90).Number), Convert.ToDouble(FRandom.Next(FRandom.Next(Rand, 0, 360), 0, 360).Number))));
 }
Esempio n. 7
0
 //Pure
 public static Particle SingularEjection <T>(T p, FRandom Rand) where T : Particle
 {
     return((T)Activator.CreateInstance(typeof(T), p.Velocity, new Vector3D(Convert.ToDouble(FRandom.Next(Rand, 0, 360).Number), Convert.ToDouble(FRandom.Next(Rand, -90, 90).Number), Convert.ToDouble(FRandom.Next(FRandom.Next(Rand, 0, 360), 0, 360).Number)))); // The values for x,y,z will be replaced by the random function to find a vector and then calculate the relative position of it from (0,0,0)
 }
Esempio n. 8
0
        protected override async Task TestPost()
        {
            FNewlyInsertedOLAMarks = new List <OlaMark>();

            Uri uri = new Uri(FBaseUri, "OLAStaging");

            int numIters = FRandom.Next(4, 10);

            for (int n = 0; n < numIters; ++n)
            {
                var newDefn = new OlaMark
                {
                    Session        = FRandom.Next(),
                    MarkStamp      = GetRandomDate(),
                    MarkAbbrev     = GetRandomString(1, false),
                    MarkingUserId  = FRandom.Next(),
                    MarkId         = FRandom.Next(),
                    Student        = GetRandomString(FRandom.Next(1, 129), true),
                    StudentContext = 1,
                    Room           = GetRandomString(FRandom.Next(1, 129), true),
                    RoomContext    = 1,
                    Status         = FRandom.Next(),
                    Uploaded       = DateTime.Now,
                    Processed      = FRandom.Next(0, 100)
                };

                if (FRandom.Next(0, 2) == 1)
                {
                    newDefn.StudentId = FRandom.Next();
                }

                if (FRandom.Next(0, 2) == 1)
                {
                    newDefn.RoomId = FRandom.Next();
                }

                if (FRandom.Next(0, 2) == 1)
                {
                    newDefn.EventId = FRandom.Next();
                }

                if (FRandom.Next(0, 2) == 1)
                {
                    newDefn.Week = FRandom.Next();
                }

                var response = await FClient.PostAsJsonAsync(uri.ToString(), newDefn);
                await CheckStatusCodeIs(response, HttpStatusCode.Created);

                var md = await response.Content.ReadAsAsync <OlaMark>();

                md.CheckSameValues(newDefn);

                FNewlyInsertedOLAMarks.Add(md);
            }

            // perform the GETItem check here...
            foreach (var m in FNewlyInsertedOLAMarks)
            {
                uri = new Uri(FBaseUri, string.Format("OLAStaging/{0}", m.Id));

                var response = await FClient.GetAsync(uri);
                await CheckSuccessStatusCode(response);

                var md = await response.Content.ReadAsAsync <OlaMark>();

                md.CheckSameValues(m);
            }
        }