public static async Task <TestingData> CollectTestingData(string name, int position)
        {
            testingData = null;
            await ConnectToServer(name, position);

            return(testingData);
        }
Esempio n. 2
0
        public void startQuiz(Action navigate)
        {
            //if (TestingData.sheet.ExamDuration != 0)
            //{
            //    Timer.Stop();
            //}

            OnsiteServices svc = new OnsiteServices();

            svc.StartExam(new ClientSheetRequest {
                ClientId = TestingData.Config.ClientId, SheetId = TestingData.sheet._id
            });

            if (TestingData.State == "READY")
            {
                TestingData.SetTimer();
            }

            TestingData.sheet.LastedStatus = "TESTING";
            TestingData.State = "TESTING";

            TestingData.Activity = StudentActivity.Testing;
            //if (TestingData.TestDuration == 0)
            //{
            //    //TestingData.sheet.ExamDuration = TestingData.sheet.ExamDuration;
            //    TestingData.TestDuration = TestingData.sheet.ExamDuration;
            //}

            navigate();
        }
Esempio n. 3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                TestingData.Seed();
            }
            //else
            //{
            //    app.UseExceptionHandler("/Home/Error");
            //    The default HSTS value is 30 days.You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
            //    app.UseHsts();
            //}
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Esempio n. 4
0
 private void OnLoad()
 {
     slider = SaveHelper.GetData <TestingData>("TestData", new TestingData {
         TestSliderValue = 0
     });
     Debug.Log("LoadData has been called", this);
 }
Esempio n. 5
0
    public static void WriteTesting(BotVersion botVersion, TestingData data)
    {
        string path = GetBotVersionTestingLogFilePath(botVersion);

        string json = JsonUtility.ToJson(data, true);

        File.AppendAllText(path, json);
    }
Esempio n. 6
0
        public void ReadFileTestMethod1()
        {
            Assert.IsTrue(File.Exists(_fileName));
            catalog _testingData = XmlFile.ReadXmlFile <catalog>(_fileName);

            Assert.IsTrue(File.Exists(_fileName));
            Assert.IsTrue(TestingData.TestTestingData(_testingData));
        }
Esempio n. 7
0
        public void WriteXmlFileTestMethod1()
        {
            Assert.IsTrue(File.Exists(_fileName));
            File.Delete(_fileName);
            catalog _testingData = TestingData.CreateTestingData();

            Assert.IsNotNull(_testingData);
            XmlFile.WriteXmlFile <catalog>(_testingData, _fileName, FileMode.OpenOrCreate);
            Assert.IsTrue(File.Exists(_fileName));
        }
Esempio n. 8
0
        public void EndExam()
        {
            OnsiteServices svc = new OnsiteServices();

            svc.EndExam(new ClientSheetRequest {
                ClientId = TestingData.Config.ClientId, SheetId = TestingData.sheet._id
            });

            TestingData.Reset();
        }
Esempio n. 9
0
        public void SearchStock_Should_ReturnEmptyArray_WhenNoMatch(string dealerCode, string make, string model, int carStockCount)
        {
            //arrange
            var cars = TestingData.GetCarStock();

            //act
            var result = _testee.SearchStock(cars, dealerCode, make, model);

            //assert
            result.Should().NotBeNull();
            result.CarStocks.Length.Should().Be(carStockCount);
        }
Esempio n. 10
0
        public void SearchStock_Should_Be_CaseInsensitive(string dealerCode, string make, string model, int carStockCount)
        {
            //arrange
            var cars = TestingData.GetCarStock();

            //act
            var result = _testee.SearchStock(cars, dealerCode, make, model);

            //assert
            result.Should().NotBeNull();
            result.CarStocks.Length.Should().Be(carStockCount);
        }
Esempio n. 11
0
        public void GetAllStock_Should_Be_CaseInsensitive(string dealerCode, int CarStockCount)
        {
            //arrange
            var cars = TestingData.GetCarStock();

            //act
            var result = _testee.GetAllCarsStock(cars, dealerCode);

            //assert
            result.Should().NotBeNull();
            result.CarStocks.Length.Should().Be(CarStockCount);
        }
Esempio n. 12
0
        public void GetAllStock_With_WrongDealerCode_Should_ReturnEmptyArray()
        {
            //arrange
            var cars = TestingData.GetCarStock();

            //act
            var result = _testee.GetAllCarsStock(cars, "A55");

            //assert
            result.Should().NotBeNull();
            result.CarStocks.Length.Should().Be(0);
        }
        /// <summary>
        /// Trying to connect to server and receive data
        /// </summary>
        /// <param name="name"></param>
        /// <param name="position"></param>
        public static async Task ConnectToServer(string name, int position)
        {
            TestingData data = null;

            //recollecting connection data from settings
            var host = Properties.Settings.Default.TestingDataHost;
            var port = Properties.Settings.Default.TestingDataPort;

            try
            {
                //Turning TLS authorization off
                AppContext.SetSwitch(
                    "System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);

                using var channel = GrpcChannel.ForAddress($"{host}:{port}");
                var client = new TestingDataRetriever.TestingDataRetrieverClient(channel);

                //Async connection
                testingData = await client.GetTestingDataAsync(
                    new ClientCredentials()
                {
                    Name       = name,
                    ClientType = (ClientType)position + 1
                });

                testingData.Comment =
                    new StringBuilder()
                    .Append(ResourceHandler.GetResource("TestingDatawaspresentedfor"))
                    .Append(name)
                    .Append(ResourceHandler.GetResource("at"))
                    .Append(DateTime.Now.ToString())
                    .ToString();
            }
            //If this is gRPC error, we know how to present it to user
            catch (RpcException ex)
            {
                testingData = new TestingData()
                {
                    Comment = ex.Message
                };
                ex.Data.Add("UserMessage", $"{ResourceHandler.GetResource("Anerroroccurredwhen")} {host}:{port}. RPC:" + ((StatusCode)(ex.StatusCode)));
                throw ex;
            }
            catch (Exception e)
            {
                testingData = new TestingData()
                {
                    Comment = e.Message
                };
            }
        }
Esempio n. 14
0
    public void WriteTestingData(bool stoppedTesting = false)
    {
        TestingData testingData = new TestingData();

        testingData.lines  = linesCleared;
        testingData.level  = level;
        testingData.score  = score;
        testingData.pieces = pieces;

        testingData.lastCalculationTime = nextActionsTime;

        testingData.stopped = stoppedTesting;

        LogWriter.WriteTesting(botVersion, testingData);
    }
        public void ProcessInput(string line)
        {
            string[] items;

            int i = TestingData.Count;

            TestingData.Add(i, new List <int>(64));
            items = line.Split(',');
            for (int j = 0; j < 64; j++)
            {
                TestingData[i].Add(int.Parse(items[j]));
            }
            ExpectedResults.Add(int.Parse(items[64]));
            //Console.WriteLine(line);
        }
Esempio n. 16
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (testingData_ != null)
        {
            hash ^= TestingData.GetHashCode();
        }
        if (optimizationReport_ != null)
        {
            hash ^= OptimizationReport.GetHashCode();
        }
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }
Esempio n. 17
0
        private void MenuItem_Click_5(object sender, RoutedEventArgs e)
        {
            if (Sim != null)
            {
                Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
                dlg.FileName   = "Document";                   // Default file name
                dlg.DefaultExt = ".xml";                       // Default file extension
                dlg.Filter     = "XML documents (.xml)|*.xml"; // Filter files by extension

                // Show save file dialog box
                bool?result = dlg.ShowDialog();

                // Process save file dialog box results
                if (result == true)
                {
                    // Save document
                    string filename    = dlg.FileName;
                    string tempRequest = System.IO.Path.GetTempPath() + "temp.xml";
                    Sim.SilentSaveAs(tempRequest);
                    TestingData.CreateTestingData(tempRequest, filename);
                }
            }
        }
Esempio n. 18
0
        private TestingData ProcessTestingData(ClientType clientType)
        {
            var testingData             = new TestingData();
            var levelOfDataDetalisation = 0;

            switch (clientType)
            {
            default:
                testingData.Comment = "Position Error";
                break;

            case ClientType.JuniorResearcher:
                testingData.SignalType  = SignalType.Oss;
                levelOfDataDetalisation = 4;
                break;

            case ClientType.Researcher:
                testingData.SignalType  = SignalType.Aws;
                levelOfDataDetalisation = 80;
                break;

            case ClientType.SeniorResearcher:
                testingData.SignalType  = SignalType.Murf;
                levelOfDataDetalisation = 500;
                break;
            }

            if (string.IsNullOrEmpty(testingData.Comment))
            {
                testingData.Lambda    = (uint)new Random().Next(0, int.MaxValue);
                testingData.Frequency = (uint)new Random().Next(0, int.MaxValue);
                testingData.Data      = new string(Enumerable.Repeat("0123456789", levelOfDataDetalisation)
                                                   .Select(s => s[new Random().Next(s.Length)]).ToArray());
            }

            return(testingData);
        }
Esempio n. 19
0
 public void MergeFrom(Data other)
 {
     if (other == null)
     {
         return;
     }
     if (other.testingData_ != null)
     {
         if (testingData_ == null)
         {
             TestingData = new global::TestingData();
         }
         TestingData.MergeFrom(other.TestingData);
     }
     if (other.optimizationReport_ != null)
     {
         if (optimizationReport_ == null)
         {
             OptimizationReport = new global::OptimizationReport();
         }
         OptimizationReport.MergeFrom(other.OptimizationReport);
     }
     _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
 }
Esempio n. 20
0
 public void Load()
 {
     data = JsonUtility.FromJson <TestingData> (PlayerPrefs.GetString("TestAllGame"));
 }