public void TestNSWPopulation()
        {
            var ireport = CodeNameResolver.GetInstance("NSW Population", "Report");
            var report  = ireport.As <Report>();

            // Check report
            CheckResourceReport(report, "Population", 5);
            Assert.IsNotNull(report.RootNode.As <ResourceReportNode>());

            // Check columns
            var columns = report.ReportColumns.OrderBy(c => c.ColumnDisplayOrder).ToArray();

            CheckIdColumn(columns[0], report.RootNode.Id);
            CheckFieldColumn <DateArgument>(columns[1], "Month", "Month", report.RootNode);
            CheckFieldColumn <IntegerArgument>(columns[2], "Male", "Male", report.RootNode);
            CheckFieldColumn <IntegerArgument>(columns[3], "Female", "Female", report.RootNode);
            CheckScriptColumn <IntegerArgument>(columns[4], "Combined", "Male+Female", report.RootNode);

            // Check conditions
            var conds = report.HasConditions.OrderBy(c => c.ConditionDisplayOrder).ToArray();

            CheckCondition <StringArgument>(conds[0], "State");   // currently returning string field??
            CheckCondition <DateArgument>(conds[1], "Month");
            CheckCondition <IntegerArgument>(conds[2], "Male");
            CheckCondition <IntegerArgument>(conds[3], "Female");
            CheckCondition <IntegerArgument>(conds[4], "Calculation");   // "Calculation" is what's in the analyzer XML. No idea why it's showing "Combined" in SL instead??
            Assert.AreEqual("NSW",
                            conds[0].ConditionParameter.ParamTypeAndDefault.As <StringArgument>().StringParameterValue);
        }
Ejemplo n.º 2
0
        public void SelfServeReportGrant( )
        {
            IAccessRuleFactory       accessRuleFactory;
            IAccessRuleReportFactory accessRuleReportFactory;
            Subject  selfServeRole;
            Solution coreDataSolution;

            accessRuleReportFactory = new AccessRuleDisplayReportFactory( );
            accessRuleFactory       = new AccessRuleFactory( );
            using (DatabaseContext databaseContext = DatabaseContext.GetContext(true))
                using (new SecurityBypassContext( ))
                {
                    selfServeRole    = Entity.Get <Subject>("core:selfServeRole", true);
                    coreDataSolution = CodeNameResolver.GetInstance("ReadiNow Core Data", "Application").As <Solution>( );

                    // Allow the test to be rerun by re-enabling the allow all Administrators access rule
                    //EnableAdministratorAccessAllRule( );

                    // Create access rules
                    //DeleteAccessRules( ReportTypeNames, SelfServeCreateAccessRuleNameTemplate );
                    CreateAccessRules(
                        accessRuleFactory,
                        accessRuleReportFactory,
                        selfServeRole,
                        SelfServeTypeNames,
                        new [] { Permissions.Create },
                        "core:createSelfServeComponentsAccessRule",
                        coreDataSolution);

                    // Disable the "allow all" administrator access rule
                    //DisableAdministratorAccessAllRule( );

                    databaseContext.CommitTransaction( );
                }
        }
Ejemplo n.º 3
0
        public void Test_Rollup_Report_On_EditForm()
        {
            using (new SecurityBypassContext())
            {
                var report         = CodeNameResolver.GetInstance("AA_All Fields Rollup", "Report");
                var typeId         = Factory.ScriptNameResolver.GetTypeByName("AA_Herb");
                var instance       = CodeNameResolver.GetInstance("Basil", "AA_Herb");
                var relationshipId = Factory.ScriptNameResolver.GetMemberOfType("AA_All Fields", typeId, MemberType.Relationship).MemberId;

                ReportSettings settings = new ReportSettings
                {
                    ReportRelationship = new ReportRelationshipSettings
                    {
                        EntityId       = instance.Id,
                        RelationshipId = relationshipId,
                        Direction      = ReportRelationshipSettings.ReportRelationshipDirection.Forward
                    },
                    RequireFullMetadata = true
                };

                var          reportInterface = new ReportingInterface();
                ReportResult result          = reportInterface.RunReport(report.Id, null);

                Assert.That(result, Is.Not.Null);
                Assert.That(result.GridData, Has.Count.GreaterThan(0));
                Assert.That(result.AggregateMetadata.Groups, Has.Count.EqualTo(2));
            }
        }
        public void GetResourceByReport( )
        {
            var personReport = CodeNameResolver.GetInstance("AA_Person", "Report");

            var getResources = new GetResourcesActivity( );

            getResources.Save( );
            //_toDelete.Add(getResources.Id);

            var getResourcesAs = getResources.As <WfActivity>( );

            ActivityImplementationBase nextActivity = getResourcesAs.CreateWindowsActivity( );

            var args = new Dictionary <string, object>
            {
                {
                    "Report", personReport
                },
            };

            IDictionary <string, object> result = RunActivity(nextActivity, args);

            var list  = result["List"] as IEnumerable <IEntity>;
            var first = result["First"];

            var personType = CodeNameResolver.GetTypeByName("AA_Person").As <EntityType>();

            long countPeople = personType.GetDescendantsAndSelf().SelectMany(t => t.InstancesOfType).Select(i => i.Id).Distinct().Count();

            Assert.IsNotNull(list);
            Assert.AreEqual(list.Count( ), countPeople, "The count of people is correct");
        }
        public void TestResultTypeOfGroupByColumn()
        {
            var ireport = CodeNameResolver.GetInstance("rpt_CHART_EmployeeManager", "Report");
            var report  = ireport.As <Report>();

            Assert.IsTrue(report.ReportColumns[0].ColumnExpression.ReportExpressionResultType.Is <ResourceArgument>());
            Assert.AreEqual("AA_Manager", report.ReportColumns[0].ColumnExpression.ReportExpressionResultType.As <ResourceArgument>().ConformsToType.Name);
            Assert.IsTrue(report.ReportColumns[1].ColumnExpression.ReportExpressionResultType.Is <IntegerArgument>());
        }
Ejemplo n.º 6
0
        public void A_ClearAll()
        {
            if (ReportId == 0)
            {
                ReportId = CodeNameResolver.GetInstance("Forms", "Report").Id;
            }

            TestHelpers.ClearServerCaches();
        }
Ejemplo n.º 7
0
        public void B_Clear_And_Warm()
        {
            if (ReportId == 0)
            {
                ReportId = CodeNameResolver.GetInstance("Forms", "Report").Id;
            }

            TestHelpers.ClearServerCaches();
            BulkPreloader.TenantWarmup();
        }
Ejemplo n.º 8
0
        public void ReportPreloadTest( )
        {
            if (_reportId == 0)
            {
                _reportId = CodeNameResolver.GetInstance("Student report", "Report").Id;
            }

            var rq = new EntityRequest(_reportId, ReportHelpers.ReportPreloaderQuery, "ReportPreloadTest");

            rq.IgnoreResultCache = true;
            BulkPreloader.Preload(rq);
        }
Ejemplo n.º 9
0
        public void Convert_AllFields()
        {
            IEntity entity = CodeNameResolver.GetInstance("AF_All Fields", "Report");
            var     report = entity.As <EDC.ReadiNow.Model.Report>();

            using (new SecurityBypassContext())
            {
                EventLog.Application.WriteTrace("Before convert report");
                var sq = ReportToQueryConverter.Instance.Convert(report);
                EventLog.Application.WriteTrace("After convert report");
            }
        }
Ejemplo n.º 10
0
 public void GrcScriptCutdown_Warmup( )
 {
     reportId        = CodeNameResolver.GetInstance("Business Units", "Report").Id;
     formId          = CodeNameResolver.GetInstance("Business Unit Form", "Custom Edit Form").Id;
     typeId          = CodeNameResolver.GetInstance("Business Unit", "Type").Id;
     tabReportId     = CodeNameResolver.GetInstance("Operational Impact List", "Report").Id;
     tabRelId        = CodeNameResolver.GetInstance("Business Function - Business Unit", "Relationship").Id;
     tabEntityTypeId = CodeNameResolver.GetInstance("Business Function", "Type").Id;
     listboxReportId = CodeNameResolver.GetInstance("Division Picker", "Report").Id;
     pickerTypeId    = CodeNameResolver.GetInstance("Employee", "Type").Id;
     pickerReportId  = CodeNameResolver.GetInstance("Employee Picker 2", "Report").Id;
 }
Ejemplo n.º 11
0
        private string GetNewBusinessUnitJson( )
        {
            string fields     = "";
            string rels       = "";
            string entityRefs = "";

            EntityType entityType = Entity.GetByName <EntityType>("Business Unit").Single( );

            Action <long> addEntityRef = (id) =>
            {
                entityRefs += ",\n{'id':" + id + ",'ns':null,'alias':null}";
            };
            Action <string, string, string> setField = (field, type, value) =>
            {
                long fieldId = Factory.ScriptNameResolver.GetMemberOfType(field, entityType.Id, MemberType.Field).MemberId;
                fields += ",\n{'fieldId':" + fieldId + ",'typeName':'" + type + "','value':'" + value + "'}";
                addEntityRef(fieldId);
            };
            Action <string, string, string> setLookup = (relationship, type, value) =>
            {
                long relId = Factory.ScriptNameResolver.GetMemberOfType(relationship, entityType.Id, MemberType.Relationship).MemberId;
                long entId = value == "%USER%" ? 99999999 : CodeNameResolver.GetInstance(value, type).Id;
                rels += ",\n{'relTypeId':{'id':" + relId + ",'ns':null,'alias':null},'instances':[{'entity':" + entId + ",'relEntity':0,'dataState':'create'}],'removeExisting':true,'autoCardinality':true}";
                addEntityRef(relId);
                addEntityRef(entId);
            };

            long instanceId = 9007199254740986;

            addEntityRef(entityType.Id);
            addEntityRef(instanceId);

            setField("Approval % Completed", "Decimal", "0");
            setField("Name", "String", "%NAME%");
            setField("Description", "Decimal", "TEST DESC");
            setField("Function Completed", "Bool", "true");
            setField("Approval Review Cycle", "Int32", "6");
            setLookup("Approval status", "Authorisation Status", "In Draft");
            setLookup("Owner", "Employee", "Peter Aylett");
            setLookup("Approval review period", "Period WMY", "months");
            setLookup("Owned by", "User Account", "%USER%");

            string statement = @"{'ids':[" + instanceId + @"],
                'entities':[{'id':" + instanceId + @",'typeIds':[" + entityType.Id + @"],
                'fields':[" + fields.Substring(1) + @"],
                'relationships':[" + rels.Substring(1) + @"],'dataState':'create'}],
                'entityRefs':[" + entityRefs.Substring(1) + @"]}";

            statement = statement.Replace("'", @"""");

            return(statement);
        }
Ejemplo n.º 12
0
        //private ExpressionNode RunSingleTest(string script, BuilderSettings settings = null)
        //{
        //    var result = ExpressionGrammar.ParseMacro(script);
        //    var root = CheckTerm(result.Root, Terms.Expression);

        //    StaticBuilder sb = new StaticBuilder();
        //    sb.Settings = settings ?? (new BuilderSettings());
        //    Expression tree = sb.CompileTree(root);

        //    return tree.Root;
        //}

        ///// <summary>
        ///// Validate that the node represents the expected parse-term.
        ///// </summary>
        //private ParseTreeNode CheckTerm(ParseTreeNode node, string expectedTerm)
        //{
        //    Assert.AreEqual(expectedTerm, node.Term.Name);
        //    return node;
        //}

        private BuilderSettings CreateBuilderSettings(string contextDefinitionName)
        {
            var definition = CodeNameResolver.GetInstance(contextDefinitionName, EntityType.EntityType_Type).Single();

            BuilderSettings settings = new BuilderSettings
            {
                RootContextType = new ExprType {
                    Type = DataType.Entity, EntityType = new EntityRef(definition.Id)
                }
            };

            return(settings);
        }
Ejemplo n.º 13
0
        public void AddMissingAccessRules()
        {
            IAccessRuleFactory       accessRuleFactory;
            IAccessRuleReportFactory accessRuleReportFactory;
            Subject  administratorsRole;
            Subject  everyoneRole;
            Solution coreDataSolution;

            accessRuleReportFactory = new AccessRuleDisplayReportFactory();
            accessRuleFactory       = new AccessRuleFactory();
            using (DatabaseContext databaseContext = DatabaseContext.GetContext(true))
                using (new SecurityBypassContext())
                {
                    administratorsRole = Entity.Get <Subject>("core:administratorRole", true);
                    everyoneRole       = Entity.Get <Subject>("core:everyoneRole", true);
                    coreDataSolution   = CodeNameResolver.GetInstance("ReadiNow Core Data", "Application").As <Solution>();

                    Console.WriteLine("Create access rule in solution {0}", coreDataSolution.Id);

                    CreateAccessRules(
                        accessRuleFactory,
                        accessRuleReportFactory,
                        administratorsRole,
                        new [] { "core:importConfig" },
                        new [] { Permissions.Create, Permissions.Read, Permissions.Modify, Permissions.Delete },
                        AdministratorsFullControlAccessRuleNameTemplate,
                        coreDataSolution);

                    CreateAccessRules(
                        accessRuleFactory,
                        accessRuleReportFactory,
                        administratorsRole,
                        new [] { "core:importRun" },
                        new [] { Permissions.Read, Permissions.Modify },
                        AdministratorsReadModifyAccessRuleNameTemplate,
                        coreDataSolution);

                    //var types = new[] { "core:board", "core:boardDimension" };
                    //DeleteAccessRules(types, EveryoneReadModifyControlAccessRuleNameTemplate);
                    //CreateAccessRules(
                    //    accessRuleFactory,
                    //    accessRuleReportFactory,
                    //    everyoneRole,
                    //    types,
                    //    new[] { Permissions.Create, Permissions.Read, Permissions.Modify },
                    //    EveryoneReadModifyControlAccessRuleNameTemplate,
                    //    coreDataSolution);

                    databaseContext.CommitTransaction();
                }
        }
Ejemplo n.º 14
0
        public void C_WithoutPreload()
        {
            if (ReportId == 0)
            {
                ReportId = CodeNameResolver.GetInstance("AF_All Fields", "Report").Id;
            }


            using (new SecurityBypassContext())
                using (Profiler.Measure("C_WithoutPreload"))
                {
                    var report = Entity.Get <Report>(ReportId);
                    var sq     = ReportToQueryConverter.Instance.Convert(report);
                }
        }
        public void TestANLSimpleChoiceCond()
        {
            var ireport = CodeNameResolver.GetInstance("ANL Simple Choice Cond", "Report");
            var report  = ireport.As <Report>();

            // Check report
            CheckResourceReport(report, "RPT_AllTypesChoice", 12);

            var rootNode   = report.RootNode.As <ResourceReportNode>();
            var choiceNode = rootNode.RelatedReportNodes.Single().As <RelationshipReportNode>();

            Assert.IsNotNull(choiceNode);
            Assert.IsFalse(choiceNode.FollowInReverse == true);

            // Check columns
            var columns = report.ReportColumns.OrderBy(c => c.ColumnDisplayOrder).ToArray();

            CheckIdColumn(columns[0], report.RootNode.Id);
            CheckFieldColumn <StringArgument>(columns[1], "Text Field", "Text Field", report.RootNode);
            CheckFieldColumn <StringArgument>(columns[2], "Multiline Text Field", "Multiline Text Field", report.RootNode);
            CheckFieldColumn <IntegerArgument>(columns[3], "Number Field", "Number Field", report.RootNode);
            CheckFieldColumn <IntegerArgument>(columns[4], "AutoNumber Field", "AutoNumber Field", report.RootNode);
            CheckFieldColumn <DecimalArgument>(columns[5], "Decimal Field", "Decimal Field", report.RootNode);
            CheckFieldColumn <CurrencyArgument>(columns[6], "Currency Field", "Currency Field", report.RootNode);
            CheckFieldColumn <DateTimeArgument>(columns[7], "Date and Time Field", "Date and Time Field", report.RootNode);
            CheckFieldColumn <DateArgument>(columns[8], "Date only Field", "Date only Field", report.RootNode);
            CheckFieldColumn <TimeArgument>(columns[9], "Time only Field", "Time only Field", report.RootNode);
            CheckFieldColumn <BoolArgument>(columns[10], "Yes/No Field", "Yes/No Field", report.RootNode);
            CheckResourceExprColumn(columns[11], "Choice Field", choiceNode.As <ReportNode>(), "RPT_Choice");

            // Check conditions
            var conds = report.HasConditions.OrderBy(c => c.ConditionDisplayOrder).ToArray();

            CheckCondition <ResourceListArgument>(conds[0], "Choice Field", "RPT_Choice");
            CheckCondition <BoolArgument>(conds[1], "Yes/No Field");
            CheckCondition <TimeArgument>(conds[2], "Time only Field");
            CheckCondition <DateArgument>(conds[3], "Date only Field");
            CheckCondition <DateTimeArgument>(conds[4], "Date and Time Field");
            CheckCondition <CurrencyArgument>(conds[5], "Currency Field");
            CheckCondition <DecimalArgument>(conds[6], "Decimal Field");
            CheckCondition <IntegerArgument>(conds[7], "AutoNumber Field");
            CheckCondition <StringArgument>(conds[8], "Multiline Text Field");
            CheckCondition <IntegerArgument>(conds[9], "Number Field");
            CheckCondition <StringArgument>(conds[10], "Text Field");
        }
Ejemplo n.º 16
0
        public void TestReport_AA_Manager( )
        {
            long reportId = CodeNameResolver.GetInstance("AA_Manager", Report.Report_Type).Single().Id;

            ReportSettings settings = new ReportSettings( );

            settings.RequireFullMetadata          = true;
            settings.SupportPaging                = true;
            settings.PageSize                     = 200;
            settings.RefreshCachedResult          = true;
            settings.RefreshCachedSql             = true;
            settings.RefreshCachedStructuredQuery = true;

            var          reportInterface = new ReportingInterface( );
            ReportResult result          = reportInterface.RunReport(reportId, settings);

            Assert.That(result, Is.Not.Null);
            Assert.That(result.GridData, Has.Count.GreaterThan(0));
        }
Ejemplo n.º 17
0
        public void Reverse_Relationship_IsCached( )
        {
            // columnRollup is a reverse relationship.
            long reportId = CodeNameResolver.GetInstance("AA_Manager", Report.Report_Type).Single( ).Id;

            string query = @"
                isOfType.id,
                reportColumns.isOfType.id,
                reportColumns.columnRollup.isOfType.id";

            var rq = new EntityRequest(reportId, query);

            BulkPreloader.Preload(rq);

            using (CacheManager.ExpectCacheHits( ))
            {
                var report = EDC.ReadiNow.Model.Entity.Get <EDC.ReadiNow.Model.Report>(reportId);
                report.ReportColumns.Any(rc => rc.ColumnRollup.Any( ));
            }
        }
Ejemplo n.º 18
0
        public void RunReportWithCpuLimit(int limit, bool expectedSets)
        {
            IEntity entity = CodeNameResolver.GetInstance("AF_All Fields", "Report");
            var     report = entity.As <EDC.ReadiNow.Model.Report>();

            var sq = ReportToQueryConverter.Instance.Convert(report);

            // Run query
            QuerySettings settings = new QuerySettings();

            settings.CpuLimitSeconds     = limit;
            settings.RefreshCachedSql    = true;
            settings.RefreshCachedResult = true;

            QueryResult result = Factory.QueryRunner.ExecuteQuery(sq, settings);

            bool foundSet   = result.Sql.Contains("set QUERY_GOVERNOR_COST_LIMIT 30");
            bool foundUnset = result.Sql.Contains("set QUERY_GOVERNOR_COST_LIMIT 0");

            Assert.That(foundSet, Is.EqualTo(expectedSets), "Found the setting of the limit");
            Assert.That(foundUnset, Is.EqualTo(expectedSets), "found the unsetting of the limit");
        }
Ejemplo n.º 19
0
        public void CloneWithoutDefinition( )
        {
            var person = CodeNameResolver.GetInstance("Jude Jacobs", "AA_Employee");

            var cloneActivity = new CloneActivity( );

            cloneActivity.Save( );
            ToDelete.Add(cloneActivity.Id);

            var nextActivity = ( CloneImplementation )cloneActivity.As <WfActivity>( ).CreateWindowsActivity( );

            var inputs = new Dictionary <string, object>
            {
                {
                    "Record", person
                }
            };

            IDictionary <string, object> result = RunActivity(nextActivity, inputs);

            var clone = ( IEntity )result["Record"];


            var ignoredFields = new List <string>
            {
                "name",
                "alias",
                "createdDate",
                "modifiedDate"
            };

            foreach (IEntity field in Person.AllFields.Where(f => f.Is <Field>( ) && ignoredFields.All(a => a != f.Alias)))
            {
                Assert.AreEqual(person.GetField(field), clone.GetField(field), "Fields are not equal:" + field.Alias);
            }
        }
Ejemplo n.º 20
0
        public void TestPreload( )
        {
            // Find report
            IEntity   entity = CodeNameResolver.GetInstance("Forms", "Report");
            EntityRef field  = (new EntityRef("core:name"));
            EntityRef rel    = (new EntityRef("core:reportColumns"));
            var       report = entity.As <EDC.ReadiNow.Model.Report>( );

            // Clear caches
            TestHelpers.ClearServerCaches( );

            // Ensure empty
            Assert.IsFalse(EntityFieldCache.Instance.ContainsKey(entity.Id) && EntityFieldCache.Instance [entity.Id].ContainsField(field.Id), "Field false");
            Assert.IsFalse(EntityRelationshipCache.Instance.ContainsKey(new EntityRelationshipCacheKey(entity.Id, Direction.Forward)) &&
                           EntityRelationshipCache.Instance [new EntityRelationshipCacheKey(entity.Id, Direction.Forward)].ContainsKey(rel.Id), "Rel false");

            // Preload report
            ReportHelpers.PreloadReport(entity.Id);

            // Ensure present
            Assert.IsTrue(EntityFieldCache.Instance.ContainsKey(entity.Id) && EntityFieldCache.Instance [entity.Id].ContainsField(field.Id), "Field true");
            Assert.IsTrue(EntityRelationshipCache.Instance.ContainsKey(new EntityRelationshipCacheKey(entity.Id, Direction.Forward)) &&
                          EntityRelationshipCache.Instance [new EntityRelationshipCacheKey(entity.Id, Direction.Forward)].ContainsKey(rel.Id), "Rel true");
        }
Ejemplo n.º 21
0
        public void TestReport_ReportToQueryConverter_WithFauxRelationship_Cached( )
        {
            long reportId       = CodeNameResolver.GetInstance("Template", "Report").Id;
            var  type           = Entity.GetByName <EntityType>("AA_DogBreeds").First();
            long relationshipId = Factory.ScriptNameResolver.GetMemberOfType("AA_All Fields", type.Id, MemberType.Relationship).MemberId;
            long foreignId1     = CodeNameResolver.GetInstance("Test 01", "AA_All Fields").Id;
            long foreignId2     = CodeNameResolver.GetInstance("Test 02", "AA_All Fields").Id;

            ReportSettings settings = new ReportSettings
            {
                ReportRelationship = new ReportRelationshipSettings
                {
                    Direction      = ReportRelationshipSettings.ReportRelationshipDirection.Forward,
                    RelationshipId = relationshipId
                },
                ReportOnType = type.Id
            };

            // Mock IReportToQueryConverter and run again
            Mock <IReportToQueryConverter> mockNonCached = new Mock <IReportToQueryConverter>(MockBehavior.Strict);
            Mock <IReportToQueryConverter> mockCached    = new Mock <IReportToQueryConverter>(MockBehavior.Strict);

            using (var scope = Factory.Current.BeginLifetimeScope(builder =>
            {
                builder.Register(ctx => mockNonCached.Object).Keyed <IReportToQueryConverter>(Factory.NonCachedKey);
                builder.Register(ctx => mockCached.Object).As <IReportToQueryConverter>( );
            }))
                using (Factory.SetCurrentScope(scope))
                {
                    var reportInterface = new ReportingInterface( );

                    IReportToQueryConverter realNonCached = new ReportToQueryConverter( );
                    IReportToQueryConverter realCached    = new CachingReportToQueryConverter(mockNonCached.Object);

                    // Setup
                    mockNonCached
                    .Setup(r2q => r2q.Convert(It.IsAny <Report>( ), It.IsAny <ReportToQueryConverterSettings>( )))
                    .Returns((Report r, ReportToQueryConverterSettings s) => realNonCached.Convert(r, s));

                    mockCached
                    .Setup(r2q => r2q.Convert(It.IsAny <Report>( ), It.IsAny <ReportToQueryConverterSettings>( )))
                    .Returns((Report r, ReportToQueryConverterSettings s) => realCached.Convert(r, s));

                    // First run
                    settings.ReportRelationship.EntityId = foreignId1;
                    ReportResult result = reportInterface.RunReport(reportId, settings);
                    Assert.That(result, Is.Not.Null);
                    Assert.That(result.GridData [0].Values [0].Value, Is.EqualTo("Afghan Hound"));

                    // Second run
                    settings.ReportRelationship.EntityId = foreignId2;
                    result = reportInterface.RunReport(reportId, settings);
                    Assert.That(result, Is.Not.Null);
                    Assert.That(result.GridData [0].Values [0].Value, Is.EqualTo("Australian Cattle Dog"));

                    // Verify
                    mockNonCached
                    .Verify(r2q => r2q.Convert(It.IsAny <Report>( ), It.IsAny <ReportToQueryConverterSettings>( )), Times.Exactly(1));

                    mockCached
                    .Verify(r2q => r2q.Convert(It.IsAny <Report>( ), It.IsAny <ReportToQueryConverterSettings>( )), Times.Exactly(2));
                }
        }