Esempio n. 1
0
 /// <summary>
 /// Test Retrieving a Record from the Data Base
 /// </summary>
 public void TestGet()
 {
     using (var controller = new ContributorApiController(_dbContext, _logger))
     {
         if (saveItem == null || saveItem.Id == null)
         {
             TestAdd();
         }
         var response = controller.GetContributor(loginToken, saveItem.Id) as OkObjectResult;
         Assert.IsNotNull(response);
         Assert.AreEqual(200, response.StatusCode);
         testItem = response.Value as Contributor;
         Assert.AreEqual(testItem.Id, saveItem.Id);
         Assert.AreEqual(testItem.Name, saveItem.Name);
         Assert.AreEqual(testItem.Description, saveItem.Description);
         Assert.AreEqual(testItem.Degree, saveItem.Degree);
         Assert.AreEqual(testItem.AlmaMater, saveItem.AlmaMater);
         Assert.AreEqual(testItem.Email, saveItem.Email);
         Assert.AreEqual(testItem.Evaluations, saveItem.Evaluations);
         Assert.AreEqual(testItem.Password, saveItem.Password);
         Assert.AreEqual(testItem.Comments, saveItem.Comments);
         Assert.AreEqual(testItem.AuditEntered, saveItem.AuditEntered);
         Assert.AreEqual(testItem.AuditEnteredBy, saveItem.AuditEnteredBy);
         Assert.AreEqual(testItem.AuditUpdated, saveItem.AuditUpdated);
         Assert.AreEqual(testItem.AuditUpdatedBy, saveItem.AuditUpdatedBy);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Test Deleting a Record from the Data Base
 /// </summary>
 public void TestDelete()
 {
     using (var controller = new ContributorApiController(_dbContext, _logger))
     {
         if (saveItem == null || saveItem.Id == null)
         {
             TestAdd();
         }
         var response = controller.DeleteContributor(loginToken, saveItem.Id) as OkResult;
         // Test to make sure the item is not found
         var notFound = controller.GetContributor(loginToken, saveItem.Id) as NotFoundResult;
         Assert.IsNotNull(notFound);
         Assert.AreEqual(404, notFound.StatusCode);
     }
 }