public void Execute_WhenIntervalRulesArePresent_ShouldFetchThem() { DroneActions.EditSettings<DroneSettings>(x => x.StoreHostname = DefaultHostUrl); DroneActions.EditSettings<ApiCallsSettings>(x => x.ApiBaseUri = DefaultBaseUrl); Api.PrepareApiResponse<ServiceEndpoints.Rules.GetIntervalRules, List<IntervalRule>>(x => { x.Add(CreateRule("gmail", "gmail.com")); x.Add(CreateRule("hotmail", "hotmail.com")); x.Add(CreateRule("aol", "aol.com")); } ); var task = new FetchIntervalRulesTask(); DroneActions.StartScheduledTask(task); DroneActions.WaitForDocumentToExist<IntervalRule>(); var result = DroneActions.FindAll<IntervalRule>(); result.Should().HaveCount(3); var domainGroups = result.Select(x => x.Group).ToList(); domainGroups.Should().BeEquivalentTo(new[] { "gmail", "hotmail", "aol" }); }
public void Execute_WhenSendingTaskIsRunningWithGroupsTogetherWithOtherTasks_ShouldStopOnlyTheGroupGiven() { DroneActions.EditSettings<DroneSettings>(x => x.StoreHostname = DefaultHostUrl); DroneActions.EditSettings<EmailingSettings>(x => { x.WritingEmailsToDiskPath = IntergrationHelpers.AssemblyDirectory; x.MailingDomain = "example.com"; }); DroneActions.StoreCollection(new[] { AddCreativePackage("gmail"), AddCreativePackage("gmail"), AddCreativePackage("hotmail"), AddCreativePackage("hotmail") }); var task1 = new SendCreativePackagesWithIntervalTask(x => { x.Group = "gmail"; }, x => x.WithIntervalInHours(1) ); var task2 = new SendCreativePackagesWithIntervalTask(x => { x.Group = "hotmail"; }, x => x.WithIntervalInHours(1) ); var anotherTask = new FetchIntervalRulesTask(); DroneActions.StartScheduledTask(task1); DroneActions.StartScheduledTask(task2); DroneActions.StartScheduledTask(anotherTask); Jobs.Drone().WaitForJobToStart(task1); Jobs.Drone().WaitForJobToStart(task2); Jobs.Drone().WaitForJobToStart(anotherTask); DroneActions.ExecuteCommand<PauseSpecificSendingJobsCommand>(x => x.Group = "gmail"); Jobs.Drone().AssertJobIsCurrentlyRunnnig<SendCreativePackagesWithIntervalTask.Data>(x => x.Group == "hotmail"); Jobs.Drone().AssertJobWasPaused<SendCreativePackagesWithIntervalTask.Data>(x => x.Group == "gmail"); }