Example #1
0
 private async Task KeywordProfileIsTestable(KeywordProfileParam gnp)
 {
     if (gnp.StoreInProject ?? false)
     {
         Results.Add(new TestResult
         {
             Message = "Keyword profile is testable.",
             Name    = "TestableProfile",
             Success = true,
         });
     }
     else
     {
         Results.Add(new TestResult
         {
             Message = "Keyword profile is not testable; results not stored in database.",
             Name    = "TestableProfile",
             Success = false,
         });
     }
 }
Example #2
0
        private async Task ProfileIsCorrectlyScoped(KeywordProfileParam gnp)
        {
            if (gnp.ScopeToProject ?? false)
            {
                using (var cmd = Db.CreateCommand())
                {
                    cmd.CommandText = @"select
                                    count(distinct node_key) as NumberOfProfileNodesOutsideLandscape
                                from
                                    report.requested_profile
                                where
                                    bag_of_words=@p1
                                    and
                                    class_code not in (select node_id from ls_node)";

                    cmd.Parameters.AddWithValue("@p1", gnp.BagOfWords);

                    using (var reader = await cmd.ExecuteReaderAsync())
                    {
                        while (await reader.ReadAsync() && !Program.StopNow)
                        {
                            int nc = (int)reader["NumberOfProfileNodesOutsideLandscape"];
                            Results.Add(new TestResult
                            {
                                Message = String.Format("Profile for [{1}] scoped to project: {0} nodes encountered that are not in dbo.ls_node.", nc, gnp.BagOfWords),
                                Name    = "ProfileCorrectlyScoped",
                                Success = (nc == 0),
                            });
                        }
                    }
                }
            }
            else
            {
                // Don't write test result; this is not testable.
            }

            // There are companies with non-zero values
        }