public void calculate_score_with_success() { var advertisement = data.GetAdversisementById(2); var oldScore = advertisement.Score; advertisementService.CalculateScore(advertisement.Id); advertisement.Score.Should().NotBe(0); oldScore.Should().NotBe(advertisement.Score); }
public async Task CalculateScore(int advertisementId) { var advertisement = database.GetAdversisementById(advertisementId); var score = GetScore(advertisement); advertisement.SetScore(score); if (score < 40) { advertisement.SetIrrelevantSince(DateTime.Now); } }
public void get_all_irrelevant_advertisement_for_quality_with_two_irrelevant_advertisement() { var advertisement = data.GetAdversisementById(2); advertisement.SetIrrelevantSince(DateTime.Now); var advertisement2 = data.GetAdversisementById(3); advertisement2.SetIrrelevantSince(DateTime.Now.AddDays(-1)); var response = controller.GetAllIrrelevantAdvertisementsForQuality(); Assert.IsType <OkObjectResult>(response); var objectResponse = response as ObjectResult; objectResponse.StatusCode.Should().Be((int)HttpStatusCode.OK); var advertisements = objectResponse.Value as List <QualityAdvertisementResponse>; advertisements.Count().Should().Be(2); }