public async Task PullEnvironmentsAsync() { Mock <IDocumentRepository <EnvironmentDetail> > repository; Mock <IStorageService> storage; TestTraceWriter traceWriter; TimerInfo timerInfo; try { repository = new Mock <IDocumentRepository <EnvironmentDetail> >(); repository.Setup( r => r.GetAsync()).Returns(Task.FromResult(GetTestEnvironments())); storage = new Mock <IStorageService>(); storage.Setup(s => s.WriteToQueueAsync( It.IsAny <string>(), It.IsAny <EnvironmentDetail>())).Returns(Task.FromResult(0)); timerInfo = new TimerInfo( new TestTimerSchedule(), new ScheduleStatus(), false); traceWriter = new TestTraceWriter(); await Environments.PullEnvironmentsAsync( timerInfo, repository.Object, storage.Object, traceWriter).ConfigureAwait(false); } catch (Exception ex) { Assert.Fail(ex.Message); } finally { repository = null; traceWriter = null; } }