public void Execute() { try { logger.Information("started deporter job"); airingServiceHelper.Deport(int.Parse(appsettings.AiringDeportGraceDays)); logger.Information("ending deporter job"); } catch (Exception e) { logger.Error(e, string.Format("Error in Deporter Job : {0}", e)); throw; } }
public void VerifyDeporterJobTest() { //Prepare IAiringService airingService = fixture.Container.GetInstance <IAiringService>(); IAiringUnitTestService airingUnitTestService = fixture.Container.GetInstance <IAiringUnitTestService>(); var dfStatusService = fixture.Container.GetInstance <IDfStatusService>(); JObject airingJson = JObject.Parse(Resources.Resources.ResourceManager.GetString("TBSAiringWithSingleFlight")); JObject response = new JObject(); var request = new RestRequest("/v1/airing/TBSE", Method.POST); request.AddParameter("application/json", UpdateAiringDates(airingJson), ParameterType.RequestBody); Task.Run(async() => { response = await _client.RetrieveRecord(request); }).Wait(); string airingId = response.Value <string>(@"airingId"); airingUnitTestService.UpdateAiringRelasedDateAndFlightEndDate(airingId, DateTime.UtcNow.AddDays(-3)); //Act airingService.Deport(int.Parse(fixture.Configuration["AiringDeportGraceDays"])); //Assert BLModel.Airing expiredairingModel = airingService.GetBy(airingId, AiringCollection.ExpiredCollection); if (expiredairingModel == null) { Assert.True(false, "Deporter Airing test Failed : Airing is not returned from Expired Collection : " + expiredairingModel.AssetId); } if (dfStatusService.HasMessages(airingId, true)) { Assert.True(false, string.Format("Deporter Airing test Failed : Airing {0} DF messages not moved to Expired Collection.", expiredairingModel.AssetId)); } }