protected override async Task<Action<AsyncCodeActivityContext>> ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { PropertyDescriptor ftpSessionProperty = context.DataContext.GetProperties()[WithFtpSession.FtpSessionPropertyName]; IFtpSession ftpSession = ftpSessionProperty?.GetValue(context.DataContext) as IFtpSession; if (ftpSession == null) { throw new InvalidOperationException("FTPSessionNotFoundException"); } bool exists = await ftpSession.DirectoryExistsAsync(RemotePath.Get(context), cancellationToken); return (asyncCodeActivityContext) => { Exists.Set(asyncCodeActivityContext, exists); }; }
public async Task should_create_time_entry() { // GIVEN var command = new CreateTimeEntries(new TimeEntryModel(DateTimeOffset.UtcNow, (int)TimeEntryType.In, UserProfileScenarioBuilder.Job1)); // WHEN var ids = await _sandbox.Mediator !.Send(command); // THEN _sandbox.Should !.Mediator !.Be("CreateTimeEntry -> TimeEntryAdded"); // TODO: check if event store has event // await _sandbox.Should!.Cassandra.Exists(id); await _sandbox.Should !.Redis !.Exists.Set("time-entry", ids.First()); await _sandbox.Should !.Redis !.Exists.SortedSet("time-entry", "by-when", 1); }