Example #1
0
        public void ApiLogic_Scan_NoKeyOrName_ResponseValid()
        {
            // Arrange
            ApiLogic logic = new ApiLogic(string.Empty, string.Empty, "notasafaweb.apphb.com");

            // Act
            logic.Scan();
        }
Example #2
0
        public void ApiLogic_ApiScanResult_JSONString_ResponseValid()
        {
            // Arrange
            // Act
            var result = ApiLogic.ApiScanResult(JSON_RESULT);

            // Assert
            Assert.That(result.GetType(), Is.EqualTo(typeof(ApiScanResult)));
        }
Example #3
0
 public MailChimpManager()
 {
     Lists         = new ListLogic(ApiKey);
     Members       = new MemberLogic(ApiKey);
     Campaigns     = new CampaignLogic(ApiKey);
     Api           = new ApiLogic(ApiKey);
     Conversations = new ConversationLogic(ApiKey);
     Content       = new ContentLogic(ApiKey);
     Apps          = new AuthorizedAppLogic(ApiKey);
 }
Example #4
0
        public void ApiLogic_Scan_NotAsafaWeb_ResponseValid()
        {
            // Arrange
            ApiLogic logic = new ApiLogic(NAME, KEY, "notasafaweb.apphb.com");
            // Act
            var result = logic.Scan();

            // Assert
            Assert.That(result.GetType(), Is.EqualTo(typeof(ApiScanResult)));
        }
Example #5
0
        public void StatusLogic_AnalyseApiResults_CorrectResultsReturned()
        {
            // Arrange
            ApiScanResult results     = ApiLogic.ApiScanResult(JSON_RESULT);
            StatusLogic   statusLogic = new StatusLogic();
            // Act
            Dictionary <string, AsafaResult> analysedResults = statusLogic.AnalyseResults(results);

            // Assert
            Assert.That(analysedResults.Count, Is.EqualTo(5));
        }
        static void Main(string[] args)
        {
            StatusLogic logic = LoadParams(args);
            ApiLogic    api   = new ApiLogic(_name, _key, _url);

            if (_validParams)
            {
                Console.Write("Selected failures: ");
                if (logic.FailOnFailure)
                {
                    Console.Write("Failures ");
                }
                if (logic.FailOnWarning)
                {
                    Console.Write("Warnings ");
                }
                if (logic.FailOnNotTested)
                {
                    Console.Write("Not Tested");
                }
                if (!logic.FailOnNotTested && !logic.FailOnWarning && !logic.FailOnFailure)
                {
                    Console.Write("None, this will always pass");
                }
                Console.WriteLine();
                if (logic.IgnoredTests.Count > 0)
                {
                    Console.WriteLine("Ignored Tests: {0}", logic.IgnoredTests.Aggregate((i, j) => i + ", " + j));
                }
                Console.WriteLine("Scanning {0}", _url);
                var results = logic.AnalyseResults(api.Scan());
                if (results.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.AppendLine("ERROR DETECTED:");
                    foreach (var asafaResult in results)
                    {
                        sb.AppendLine(string.Format("The {0} test has failed with the status {1}", asafaResult.Key, asafaResult.Value));
                    }
                    sb.AppendLine();
                    sb.AppendLine(string.Format("For more information visit https://asafaweb.com/Scan?Url={0}", HttpUtility.UrlEncode(_url)));
                    Console.WriteLine(sb.ToString());
                    if (_throwExceptionOnFail)
                    {
                        throw new Exception(sb.ToString());
                    }
                }
                Console.WriteLine("No errors found");
            }
        }
Example #7
0
 public MailChimpManager(string apiKey) : base(apiKey)
 {
     Api                   = new ApiLogic(ApiKey);
     Apps                  = new AuthorizedAppLogic(ApiKey);
     AutomationEmails      = new AutomationEmailLogic(ApiKey);
     AutomationEmailQueues = new AutomationEmailQueueLogic(ApiKey);
     Automations           = new AutomationLogic(ApiKey);
     AutomationSubscribers = new AutomationSubscriberLogic(ApiKey);
     Campaigns             = new CampaignLogic(ApiKey);
     Content               = new ContentLogic(ApiKey);
     Conversations         = new ConversationLogic(ApiKey);
     Feedback              = new FeedBackLogic(ApiKey);
     Lists                 = new ListLogic(ApiKey);
     Members               = new MemberLogic(ApiKey);
     Messages              = new MessageLogic(ApiKey);
     Reports               = new ReportLogic(ApiKey);
     TemplateFolders       = new TemplateFolderLogic(ApiKey);
     Templates             = new TemplateLogic(ApiKey);
 }
        public MailChimpManager(IOptions <MailchimpOptions> optionsAccessor) : base(optionsAccessor)
        {
            var options = optionsAccessor.Value;

            Activities            = new ActivityLogic(options);
            AbuseReports          = new AbuseReportLogic(options);
            Api                   = new ApiLogic(options);
            Apps                  = new AuthorizedAppLogic(options);
            AutomationEmails      = new AutomationEmailLogic(options);
            AutomationEmailQueues = new AutomationEmailQueueLogic(options);
            Automations           = new AutomationLogic(options);
            AutomationSubscribers = new AutomationSubscriberLogic(options);
            Batches               = new BatchLogic(options);
            Campaigns             = new CampaignLogic(options);
            CampaignFolders       = new CampaignFolderLogic(options);
            Clients               = new ClientLogic(options);
            Content               = new ContentLogic(options);
            Conversations         = new ConversationLogic(options);
            ECommerceStores       = new ECommerceLogic(options);
            Feedback              = new FeedBackLogic(options);
            FileManagerFiles      = new FileManagerFileLogic(options);
            FileManagerFolders    = new FileManagerFolderLogic(options);
            GrowthHistories       = new GrowthHistoryLogic(options);
            InterestCategories    = new InterestCategoryLogic(options);
            Interests             = new InterestLogic(options);
            Lists                 = new ListLogic(options);
            ListSegments          = new ListSegmentLogic(options);
            Members               = new MemberLogic(options);
            MergeFields           = new MergeFieldLogic(options);
            Messages              = new MessageLogic(options);
            Notes                 = new NoteLogic(options);
            Reports               = new ReportLogic(options);
            TemplateFolders       = new TemplateFolderLogic(options);
            Templates             = new TemplateLogic(options);
            WebHooks              = new WebHookLogic(options);
        }
Example #9
0
        public void InitStudentFromDb()
        {
            Logger.Info("Getting student info from database");

            Student = new ApiLogic().GetStudentByLogin(Student.Login);
        }