コード例 #1
0
        public void SendDiseaseDataSet()
        {
            // arrange
            var _client = new HttpClient();

            DiseaseAcknowledgeSet resData = new DiseaseAcknowledgeSet()
            {
                userID        = Guid.NewGuid(),
                time          = DateTime.Now,
                diseaseID     = "1",
                testResult    = true,
                authenticator = new AuthenticationData()
                {
                    userName = "******", hashedPwd = "abc123def"
                }
            };

            var json    = JsonConvert.SerializeObject(resData);
            var content = new StringContent(json, Encoding.UTF8, "application/json");

            // act
            HttpResponseMessage response = _client.PostAsync(new Uri(Constants.url + "/api/symptome/senddiseasedataset"), content).Result;



            // assert
            Assert.IsTrue(response.IsSuccessStatusCode, "Statuscode " + response.StatusCode + " returned");
            Assert.IsNotNull(response.Content);
        }
コード例 #2
0
ファイル: dataSetService.cs プロジェクト: stan1025/WirVsVirus
 /// <summary>
 /// Insert the acknowledged test result
 /// from a medical doctor.
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public bool SendDiseaseDataSet(DiseaseAcknowledgeSet data)
 {
     try
     {
         if (data.authenticator.userName.Equals("Dr. Stutz"))
         {
             return(false);
         }
         lock (tableLock)
         {
             UserDataSet dataSet = table.FirstOrDefault(item => item.Ident.Equals(data.userID) && item.Time.Equals(data.time));
             dataSet.Acknowledments.Add(new DiseaseAcknowledgement()
             {
                 id = data.diseaseID, acknowledged = data.testResult
             });
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
コード例 #3
0
 public void SendDiseaseDataSet(Guid id, DiseaseAcknowledgeSet value)
 {
     dataService.SendDiseaseDataSet(value);
 }