public virtual NotificationSubscriptionResponse UnsubscribeFromNotifications(string emailAddress) { try { NotificationSubscription subscription = TestingRepository.Query <NotificationSubscription>(Query.Where(nameof(NotificationSubscription.EmailAddress)) == emailAddress).FirstOrDefault(); string uuid = string.Empty; SubscriptionStatus status = SubscriptionStatus.NotFound; if (subscription != null) { subscription.IsActive = false; subscription = TestingRepository.Save(subscription); uuid = subscription.Uuid; status = SubscriptionStatus.NotActive; } return(new NotificationSubscriptionResponse { Success = true, SubscriptionStatus = status, Uuid = uuid }); } catch (Exception ex) { return(new NotificationSubscriptionResponse { Success = false, Message = ex.Message }); } }
public virtual NotificationSubscriptionResponse SubscribeToNotifications(string emailAddress) { try { NotificationSubscription subscription = TestingRepository.Query <NotificationSubscription>(Query.Where(nameof(NotificationSubscription.EmailAddress)) == emailAddress).FirstOrDefault(); if (subscription == null) { subscription = new NotificationSubscription() { EmailAddress = emailAddress }; } subscription.IsActive = true; subscription = TestingRepository.Save(subscription); return(new NotificationSubscriptionResponse { Success = true, Data = subscription, SubscriptionStatus = SubscriptionStatus.Active, Uuid = subscription.Uuid }); } catch (Exception ex) { return(new NotificationSubscriptionResponse { Success = false, Message = ex.Message }); } }
private TestDefinition GetTestDefinition(string suiteTitle, string testTitle) { TestSuiteDefinition suite = TestingRepository.Query <TestSuiteDefinition>(Query.Where(nameof(TestSuiteDefinition.Title)) == suiteTitle).FirstOrDefault(); if (suite == null) { suite = GetOrCreateSuiteDefinition(new TestSuiteDefinition { Title = suiteTitle }); } TestDefinition result = TestingRepository.Query <TestDefinition>(Query.Where(nameof(TestDefinition.Title)) == testTitle && Query.Where(nameof(TestDefinition.TestSuiteDefinitionId)) == suite.Id).FirstOrDefault(); if (result == null) { result = GetOrCreateTestDefinition(suiteTitle, new TestDefinition { Title = testTitle }); } return(result); }
public virtual RetrieveNotificationSubscriptionsResponse RetrieveNotificationSubscribers() { try { NotificationSubscription[] subscriptions = TestingRepository.Query <NotificationSubscription>(Query.Where("IsActive") == true).ToArray(); return(new RetrieveNotificationSubscriptionsResponse { Success = true, Data = subscriptions }); } catch (Exception ex) { return(new RetrieveNotificationSubscriptionsResponse { Success = false, Message = ex.Message }); } }
public virtual SearchTestExecutionResponse SearchTestExecutionsByTestDefinitionId(long testId) { try { List <TestExecution> results = TestingRepository.Query <TestExecution>( QueryFilter.Where(nameof(TestExecution.TestDefinitionId)) == testId).ToList(); return(new SearchTestExecutionResponse { Success = true, Data = results }); } catch (Exception ex) { return(new SearchTestExecutionResponse { Success = false, Message = ex.Message }); } }
public virtual RetrieveTestExecutionResponse RetrieveFailedTestExecutions(string tag) { try { List <TestExecution> failedTestRuns = TestingRepository.Query <TestExecution>(Filter.Where("Passed") == 0 && Filter.Where("Tag") == tag).ToList(); return(new RetrieveTestExecutionResponse { Success = true, Data = failedTestRuns.Select(te => new { te.TestDefinition.AssemblyFullName, te.TestDefinition.MethodName, te.TestDefinition.Description, te.Exception, te.StackTrace }).ToArray() }); } catch (Exception ex) { return(new RetrieveTestExecutionResponse { Success = false, Message = ex.Message }); } }
public virtual SearchTestExecutionResponse SearchTestExecutionsByDate(DateTime from, DateTime to) { try { List <TestExecution> results = TestingRepository.Query <TestExecution>( QueryFilter.Where(nameof(TestExecution.StartedTime)) > from && QueryFilter.Where(nameof(TestExecution.StartedTime)) > to).ToList(); return(new SearchTestExecutionResponse { Success = true, Data = results }); } catch (Exception ex) { return(new SearchTestExecutionResponse { Success = false, Message = ex.Message }); } }
public virtual RetrieveTestExecutionResponse RetrieveTestExecutionByUuid(string uuid) { try { TestExecution queried = TestingRepository.Query <TestExecution>(Query.Where("Uuid") == uuid).FirstOrDefault(); if (queried == null) { Args.Throw <ArgumentException>("TestExecution with the specified Uuid was not found: {0}", uuid); } TestExecution retrieved = TestingRepository.Retrieve <TestExecution>(queried.Id); return(new RetrieveTestExecutionResponse { Success = true, Data = retrieved }); } catch (Exception ex) { return(new RetrieveTestExecutionResponse { Success = false, Message = ex.Message }); } }