Exemplo n.º 1
0
        private static void AssertDefinitionContains(ViewDefinition viewDefinition, ViewResultEntry viewResultEntry)
        {
            var configuration = viewDefinition.CalculationConfigurationsByName[viewResultEntry.CalculationConfiguration];

            var valueSpecification = viewResultEntry.ComputedValue.Specification;

            foreach (var req in configuration.SpecificRequirements)
            {
                bool matches = (req.TargetSpecification.Uid ==
                                valueSpecification.TargetSpecification.Uid &&
                                req.TargetSpecification.Type == valueSpecification.TargetSpecification.Type &&
                                req.ValueName == valueSpecification.ValueName) &&
                               req.Constraints.IsSatisfiedBy(valueSpecification.Properties);

                if (matches)
                {
                    return;
                }
            }

            var reqsByType = configuration.PortfolioRequirementsBySecurityType;

            if (!reqsByType.Any(r => r.Value.Any(t => t.Item1 == valueSpecification.ValueName)))
            {
                Assert.True(false,
                            string.Format("Unmatched requirement {0},{1},{2} on {3}", valueSpecification.ValueName,
                                          valueSpecification.TargetSpecification.Type,
                                          valueSpecification.TargetSpecification.Uid, viewDefinition.Name));
            }
        }
 private static ColumnHeader GetColumnHeader(ViewResultEntry v)
 {
     return(new ColumnHeader(v.CalculationConfiguration, v.ComputedValue.Specification.ValueName, v.ComputedValue.Specification.Properties));
 }