public static void Install_1_Resolves_ISession() { var dbFactory = _container.Resolve <IDbFactory>(); ITestSession session = null; Assert.DoesNotThrow(() => session = dbFactory.Create <ITestSession>()); Assert.That(session, Is.Not.Null); }
public static async Task <HttpResponseMessage> RolesDeleteByIdAsync(this ITestSession session, WebId roleId) { var query = new EastFive.Api.Azure.Resources.Queries.RoleQuery { Id = roleId, }; var response = await session.DeleteAsync <EastFive.Api.Azure.Controllers.RoleController>(query); return(response); }
public TestSession(IObjectFactory <IPipelineAction> pipelineActionFactory, ITestSession customTestSession, ILoggerFactory loggerFactory, IDictionary <string, string> options, ICriticalSectionTokensProvider <TestCase> criticalSectionTokensProvider = null) { _results = new ConcurrentBag <TestCaseExecutionResult>(); _customTestSession = customTestSession; _logger = loggerFactory.CreateLogger <TestSession>(); Options = new ReadOnlyDictionary <string, string>(options); _criticalSectionTokensProvider = criticalSectionTokensProvider; _tasks = new List <Task>(); _cancellationToken = Task.Factory.CancellationToken; _pipelineActionFactory = pipelineActionFactory; }
public static async Task <TResult> RolesGetByActorAsync <TResult>(this ITestSession session, WebId actorId, Func <HttpResponseMessage, Func <EastFive.Api.Azure.Resources.Role[]>, TResult> callback) { var query = new EastFive.Api.Azure.Resources.Queries.RoleQuery { Actor = actorId, }; var response = await session.GetAsync <EastFive.Api.Azure.Controllers.RoleController>(query); return(callback(response, () => response.GetContentMultipart <EastFive.Api.Azure.Resources.Role>().ToArray())); }
public static async Task <TResult> ActAsUserGetAsync <TResult>(this ITestSession session, string redirectUri, Func <HttpResponseMessage, Func <UserInfo[]>, TResult> callback) { var query = new ActAsUserQuery { RedirectUri = redirectUri, }; var response = await session.GetAsync <ActAsUserController>(query); return(callback(response, () => response.GetContentMultipart <UserInfo>().ToArray())); }
public static async Task <TResult> ActAsUserGetAsync <TResult>(this ITestSession session, Guid actorId, string redirectUri, Func <HttpResponseMessage, TResult> callback) { var query = new ActAsUserQuery { ActorId = actorId, RedirectUri = redirectUri, }; var response = await session.GetAsync <ActAsUserController>(query); return(callback(response)); }
public static ITestSession GetSuperAdmin(this ITestSession session) { return(Web.Configuration.Settings.GetString(EastFive.Api.AppSettings.SiteAdminAuthorization, (siteAdminAuthToken) => { var superAdminSession = new TestSession(siteAdminAuthToken); return superAdminSession; }, (why) => { Assert.Fail(why); throw new Exception(why); })); }
private TResult SendgridMailService <TResult>(ITestSession session, Func <TResult> callback) { var currentMailFetch = EastFive.Web.Services.ServiceConfiguration.SendMessageService; //var sendgridMailer = EastFive.SendGrid.SendGridMailer.Load( // mailer => mailer, // (why)=> throw new Exception(why)); //EastFive.Web.Services.ServiceConfiguration.SendMessageService = // () => sendgridMailer; var result = callback(); EastFive.Web.Services.ServiceConfiguration.SendMessageService = currentMailFetch; return(result); }
public static async Task <TResult> RolesPostAsync <TResult>(this ITestSession session, WebId actorId, string role, Func <HttpResponseMessage, EastFive.Api.Azure.Resources.Role, TResult> callback) { //Create the order via post var resource = new EastFive.Api.Azure.Resources.Role() { Id = Guid.NewGuid(), Actor = actorId, Name = role, }; var response = await session.PostAsync <EastFive.Api.Azure.Controllers.RoleController>(resource); return(callback(response, resource)); }
public static async Task <TResult> CredentialPostAsync <TResult>(this ITestSession session, EastFive.Api.Azure.Credentials.CredentialValidationMethodTypes method, string subject, Guid authentication, Func <HttpResponseMessage, Credential, TResult> callback) { //Create the order via post var resource = new Credential() { Id = Guid.NewGuid(), Authentication = authentication, Method = method, Subject = subject, }; var response = await session.PostAsync <EastFive.Api.Azure.Credentials.Controllers.CredentialController>(resource); return(callback(response, resource)); }
public static async Task <TResult> ResponseGetAsync <TResult>(this ITestSession session, CredentialValidationMethodTypes method, IDictionary <string, string> extraParams, Func <HttpResponseMessage, TResult> callback) { var query = new ResponseResult { method = method, }; var response = await session.GetAsync <ResponseController>(query, (request) => { request.RequestUri = extraParams.Aggregate( request.RequestUri, (requestUri, queryParam) => requestUri.SetQueryParam(queryParam.Key, queryParam.Value)); }); return(callback(response)); }
public static async Task <HttpResponseMessage> ClaimPostAsync(this ITestSession testSession, Guid authId, string type, string value, string issuer = default(string)) { Uri issuerUri; Uri.TryCreate(issuer, UriKind.RelativeOrAbsolute, out issuerUri); var claim = new Resources.Claim() { Id = Guid.NewGuid(), AuthorizationId = authId, Issuer = issuerUri, Type = new Uri(type), Value = value, Signature = "", }; return(await testSession.PostAsync <AccountLinksController>(claim)); }
public static async Task <TResult> AuthenticationRequestLinksGetAsync <TResult>(this ITestSession session, Func <HttpResponseMessage, Func <AuthenticationRequestLink[]>, TResult> callback) { var authenticationRequestLinksQuery = new AuthenticationRequestLinkQuery() { }; var response = await session.GetAsync <AuthenticationRequestLinkController>(authenticationRequestLinksQuery); throw new NotImplementedException(); //return callback(response, () => response // .GetContentMultipart<Resources.AuthenticationRequestLink>() // .ToArray()); }
public TypeCollector(IType originalObject, ITestSession testSession, ISutSession sutSession) { OriginalObject = originalObject; _testSession = testSession; _sutSession = sutSession; }
public static async Task <SessionServer.Tests.TestCredential> CreateCredentialAsync(this ITestSession session) { return(await(new SessionServer.Tests.TestCredential()).ToTask()); }
public static async Task <TResult> AuthenticationRequestGetAsync <TResult>(this ITestSession session, WebId authenticationRequestId, Func <HttpResponseMessage, Func <EastFive.Azure.Auth.Session>, TResult> callback) { throw new NotImplementedException(); }
public async Task <IReadOnlyCollection <TestCaseExecutionResult> > RunTestsAsync(ITestSession customSession, IDictionary <string, string> options) { //discover var testCases = _testStorage.GetTestCaseIds().Select(id => _testStorage.GetTestCase(id)); //filter testCases = FilterByTags(testCases, options); //order if (_priorityProvider != null) { testCases = testCases.OrderBy(_priorityProvider.GetPriority); } //execute using (var testSession = new TestSession(_pipelineActionFactory, customSession, _loggerFactory, options, _criticalSectionTokensProvider)) { await testSession.ExecuteAsync(testCases, options.GetWorkersCount()); return(testSession.Results); } }