public static async Task <PluralsightActivity> RunAsync([ActivityTrigger] IDurableActivityContext context, ILogger log) { var week = context.GetInput <Week>(); log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}"); var pluralsightId = Environment.GetEnvironmentVariable("PluralsightId", EnvironmentVariableTarget.Process); var proxy = new PluralsightProxy(log); log.LogInformation($"Retrieving data for ${week.Start.ToShortDateString()} to ${week.End.ToShortDateString()}"); await proxy.PopulateAsync(pluralsightId, week.Start, week.End); log.LogInformation($"Return the Pluralsight Activity"); return(proxy.GetPluralsightActivity()); }
public async Task GetsData() { var logger = new Mock <ILogger>(); var sut = new PluralsightProxy(logger.Object); await sut.PopulateAsync("POPULATE ME", DateTime.Now.AddDays(-7), DateTime.Now); var activity = sut.GetPluralsightActivity(); Assert.NotEmpty(activity.Courses); var first = activity.Courses.First(); Assert.NotEmpty(first.CourseId); Assert.NotEmpty(first.CourseImageUrl); Assert.NotEmpty(first.Description); Assert.Equal(100, first.PercentageComplete); Assert.NotEmpty(first.ShortDescription); Assert.NotEmpty(first.Title); Assert.NotEmpty(first.Url); }