Beispiel #1
0
        protected IEnumerable <ContextCheckerResult> FaceConstructMustBeAbaqusModelBased()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            if (this.testBench.Children.FaceCollection.Any())
            {
                switch (this.testBench.Attributes.SolverType)
                {
                case CyPhyClasses.CADTestBench.AttributesClass.SolverType_enum.ABAQUS_Model_Based:
                    foreach (var face in this.testBench.Children.FaceCollection)
                    {
                        var feedback = new ContextCheckerResult()
                        {
                            Success = true,
                            Subject = face.Impl,
                            Message = string.Format("Face construct allowed for solver type ABAQUS model based.")
                        };

                        results.Add(feedback);
                    }

                    break;

                case CyPhyClasses.CADTestBench.AttributesClass.SolverType_enum.ABAQUS_Deck_Based:
                    break;

                case CyPhyClasses.CADTestBench.AttributesClass.SolverType_enum.NASTRAN:
                    break;
                }
            }

            return(results);
        }
        /// <summary>
        /// TODO: description what we check...
        /// <para><remarks>Execute within transaction.</remarks></para>
        /// </summary>
        /// <returns>Checker results.</returns>
        protected IEnumerable <ContextCheckerResult> AtLeastOneTestInjectionPoints()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            if (this.testBench.Children.TestInjectionPointCollection.Any())
            {
                foreach (var tip in this.testBench.Children.TestInjectionPointCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = tip.Impl,
                        Message = "Test bench has test injection point."
                    };

                    results.Add(feedback);

                    results.AddRange(this.ValidateTestInjectionPoint(tip.Impl as GME.MGA.MgaReference));
                }
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = this.testBench.Impl,
                    Message = "No test injection points. Test bench must have at least one test injection point."
                };

                results.Add(feedback);
            }

            return(results);
        }
        /// <summary>
        /// TODO: description what we check...
        /// <para><remarks>Execute within transaction.</remarks></para>
        /// </summary>
        /// <returns>Checker results.</returns>
        protected IEnumerable <ContextCheckerResult> NoTestInjectionPoints()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            if (this.testBench.Children.TestInjectionPointCollection.Any())
            {
                foreach (var tip in this.testBench.Children.TestInjectionPointCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = tip.Impl,
                        Message = "Test injection points are not allowed in this type of test bench."
                    };

                    results.Add(feedback);
                }
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = this.testBench.Impl,
                    Message = "No test injection points."
                };

                results.Add(feedback);
            }

            return(results);
        }
        protected IEnumerable <ContextCheckerResult> HasShotLinesAndAtLeastOneBallisticTarget()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            if (this.testBench.Children.ShotlineModelCollection.Any())
            {
                if (this.testBench.Children.BallisticTargetCollection.Any())
                {
                    // ok
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = this.testBench.Impl,
                        Message = "Test bench has at least one BallisticTarget component and has at least one shotline models."
                    };

                    results.Add(feedback);
                }
                else
                {
                    // at least one ballistic target is required
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = this.testBench.Impl,
                        Message = "At least one BallisticTarget component is required, when test bench has shotline models."
                    };

                    results.Add(feedback);
                }
            }

            return(results);
        }
        protected IEnumerable <ContextCheckerResult> NoComponentRefOrComponents()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            if (this.testBench.Children.ComponentRefCollection.Any())
            {
                foreach (var tip in this.testBench.Children.ComponentRefCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = tip.Impl,
                        Message = string.Format("Component references are not allowed in test bench.", this.testBench.Kind)
                    };

                    results.Add(feedback);
                }
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = this.testBench.Impl,
                    Message = string.Format("No component references in {0}.", this.testBench.Kind)
                };

                results.Add(feedback);
            }

            if (this.testBench.Children.ComponentCollection.Any())
            {
                foreach (var tip in this.testBench.Children.ComponentCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = tip.Impl,
                        Message = string.Format("Components are not allowed in test bench.", this.testBench.Kind)
                    };

                    results.Add(feedback);
                }
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = this.testBench.Impl,
                    Message = string.Format("No component in {0}.", this.testBench.Kind)
                };

                results.Add(feedback);
            }

            return(results);
        }
        protected IEnumerable <ContextCheckerResult> HasAPredefinedAndNoBallisticTarget()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();
            var predefinedCount = this.testBench.Children.PredefinedBallisticSuiteCollection.Count();

            if (predefinedCount == 1)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = this.testBench.Children.PredefinedBallisticSuiteCollection.FirstOrDefault().Impl,
                    Message = "Test bench has exactly one PredefinedBallisticSuite."
                };

                results.Add(feedback);

                if (this.testBench.Children.BallisticTargetCollection.Any())
                {
                    feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = this.testBench.Impl,
                        Message = "If test bench has PredefinedBallisticSuite, it cannot have BallisticTarget."
                    };

                    results.Add(feedback);
                }
                else
                {
                    feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = this.testBench.Impl,
                        Message = "Test bench has PredefinedBallisticSuite and does not have BallisticTarget."
                    };

                    results.Add(feedback);
                }
            }
            else if (predefinedCount > 1)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = this.testBench.Impl,
                    Message = "Test bench cannot have more than one PredefinedBallisticSuite."
                };

                results.Add(feedback);
            }

            return(results);
        }
        protected IEnumerable <ContextCheckerResult> ExactlyOneReferencePlane()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            var referencePlaneCount = this.testBench.Children.ReferencePlaneCollection.Count();

            if (referencePlaneCount == 0)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = this.testBench.Impl,
                    Message = "Test bench must have one reference plane."
                };

                results.Add(feedback);
            }
            else if (referencePlaneCount == 1)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = this.testBench.Children.ReferencePlaneCollection.FirstOrDefault().Impl,
                    Message = "One reference plane found."
                };

                results.Add(feedback);
            }
            else if (referencePlaneCount > 1)
            {
                foreach (var referencePlane in this.testBench.Children.ReferencePlaneCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = referencePlane.Impl,
                        Message = "Only one ReferencePlace object is allowed."
                    };

                    results.Add(feedback);
                }
            }
            else
            {
                throw new NotImplementedException();
            }


            return(results);
        }
        protected IEnumerable<ContextCheckerResult> ExactlyOneDriver()
        {
            List<ContextCheckerResult> results = new List<ContextCheckerResult>();

            var pccDriverCount = this.parametricExploration.Children.PCCDriverCollection.Count();
            var optimizerCount = this.parametricExploration.Children.OptimizerCollection.Count();
            var parameterStudyCount = this.parametricExploration.Children.ParameterStudyCollection.Count();


            if (pccDriverCount + optimizerCount + parameterStudyCount == 0)
            {
                string errorMessage = "Parametric Exploration model has no driver. It must have exactly one driver PCCDriver OR Optimizer OR ParameterStudy.";

                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = this.parametricExploration.Impl,
                    Message = errorMessage
                };

                results.Add(feedback);
            }
            else if (pccDriverCount + optimizerCount + parameterStudyCount == 1)
            {
                foreach (var pccDriver in this.parametricExploration.Children.PCCDriverCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = pccDriver.Impl,
                        Message = string.Format("Test bench has exectly driver: {0}.", pccDriver.Kind)
                    };

                    results.Add(feedback);
                }

                foreach (var optimizer in this.parametricExploration.Children.OptimizerCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = optimizer.Impl,
                        Message = string.Format("Test bench has exectly driver: {0}.", optimizer.Kind)
                    };

                    results.Add(feedback);
                }

                foreach (var parameterStudy in this.parametricExploration.Children.ParameterStudyCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = parameterStudy.Impl,
                        Message = string.Format("Test bench has exectly driver: {0}.", parameterStudy.Kind)
                    };

                    results.Add(feedback);
                }
            }
            else if (pccDriverCount + optimizerCount + parameterStudyCount > 1)
            {
                string errorMessage = "Parametric Exploration model must have exactly one driver PCCDriver OR Optimizer OR ParameterStudy.";

                foreach (var pccDriver in this.parametricExploration.Children.PCCDriverCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = pccDriver.Impl,
                        Message = errorMessage
                    };

                    results.Add(feedback);
                }

                foreach (var optimizer in this.parametricExploration.Children.OptimizerCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = optimizer.Impl,
                        Message = errorMessage
                    };

                    results.Add(feedback);
                }

                foreach (var parameterStudy in this.parametricExploration.Children.ParameterStudyCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = parameterStudy.Impl,
                        Message = errorMessage
                    };

                    results.Add(feedback);
                }
            }
            else
            {
                throw new NotImplementedException();
            }


            return results;
        }
        protected IEnumerable<ContextCheckerResult> TestBenchReferences()
        {
            List<ContextCheckerResult> results = new List<ContextCheckerResult>();

            // at least one test bench ref
            if (this.testBenchSuite.Children.TestBenchRefCollection.Any())
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = this.testBenchSuite.Impl,
                    Message = "Test bench suite has at least one test bench reference."
                };

                results.Add(feedback);

                var ids = this.testBenchSuite
                    .Children
                    .TestBenchRefCollection
                    .Where(x => (x.Impl as GME.MGA.IMgaReference).Referred != null)
                    .Select(x => (x.Impl as GME.MGA.IMgaReference).Referred.ID)
                    .ToList();

                if (ids.Count != ids.Distinct().Count())
                {
                    feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = this.testBenchSuite.Impl,
                        Message = "One test bench can be used only once. Remove the duplicates."
                    };

                    results.Add(feedback);
                }
                else
                {
                    feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = this.testBenchSuite.Impl,
                        Message = "Each test bench used only once."
                    };

                    results.Add(feedback);
                }
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = this.testBenchSuite.Impl,
                    Message = "Test bench suite has no test bench reference. It must have at least one test bench reference."
                };

                results.Add(feedback);
            }

            CyPhy.DesignEntity designEntity = null;

            // no null refs
            foreach (var testBenchRef in this.testBenchSuite.Children.TestBenchRefCollection)
            {
                // check test benches
                if (testBenchRef.AllReferred == null)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = testBenchRef.Impl,
                        Message = "Test bench reference cannot be null."
                    };

                    results.Add(feedback);

                    continue;
                }
                else if ((testBenchRef.AllReferred is CyPhy.TestBenchType) == false)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = testBenchRef.Impl,
                        Message = "Currently only Test Bench Types are allowed."
                    };

                    results.Add(feedback);

                    continue;
                }
                else
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = testBenchRef.Impl,
                        Message = "Test bench reference is not null."
                    };

                    results.Add(feedback);
                }

                var testBench = testBenchRef.AllReferred as CyPhy.TestBenchType;

                // testbench ref is NOT null at this point
                ContextChecker testBenchChecker = ContextChecker.GetContextChecker(testBench.Impl as GME.MGA.MgaModel);

                testBenchChecker.TryCheck();

                results.AddRange(testBenchChecker.Details);

                // check top level system under test pointers
                var tlsut = testBench.Children.TopLevelSystemUnderTestCollection.FirstOrDefault();
                
                if (tlsut != null &&
                    tlsut.Referred.DesignEntity != null)
                {
                    if (designEntity == null)
                    {
                        designEntity = tlsut.Referred.DesignEntity;
                    }
                    else
                    {
                        if (designEntity.Impl.ID == tlsut.Referred.DesignEntity.ID)
                        {
                            var feedback = new ContextCheckerResult()
                            {
                                Success = true,
                                Subject = testBenchRef.Impl,
                                Message = "Test bench is defined for the same design or design space."
                            };

                            results.Add(feedback);
                        }
                        else
                        {
                            var feedback = new ContextCheckerResult()
                            {
                                Success = false,
                                Subject = testBenchRef.Impl,
                                Message = "Test bench does not point to the same design space."
                            };

                            results.Add(feedback);
                        }
                    }
                }
            }

            return results;
        }
Beispiel #10
0
        /// <summary>
        /// Context is not a library element or subtype or instance or read-only.
        /// <para><remarks>Execute within transaction.</remarks></para>
        /// </summary>
        /// <returns>Checker results.</returns>
        protected IEnumerable<ContextCheckerResult> NotLibraryOrSubtypeOrInstanceOrReadOnly()
        {
            List<ContextCheckerResult> results = new List<ContextCheckerResult>();

            var context = this.GetContext();

            if (context.IsLibObject)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = context,
                    Message = string.Format("{0} cannot be a library object.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = context,
                    Message = string.Format("{0} is not a library object.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }

            if (context.IsInstance)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = context,
                    Message = string.Format("{0} cannot be an instance.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = context,
                    Message = string.Format("{0} is not an instance.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }

            if (context.ArcheType != null)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = context,
                    Message = string.Format("{0} cannot be an subtype or instance.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = context,
                    Message = string.Format("{0} is not a subtype or instance.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }


            if (context.HasReadOnlyAccess())
            {
                var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = context,
                        Message = string.Format("{0} cannot be read-only.", context.MetaBase.Name)
                    };

                results.Add(feedback);
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = context,
                    Message = string.Format("{0} is writable.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }

            return results;
        }
        protected IEnumerable <ContextCheckerResult> TestBenchReferences()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            var allParametricExplorations = getParametricExplorationsRecursively(this.parametricExploration).ToList();
            var testBenchRefCount         = allParametricExplorations.SelectMany(pe => pe.Children.TestBenchRefCollection).Count();

            testBenchRefCount += allParametricExplorations.SelectMany(pe => pe.Children.ParametricTestBenchCollection).Count();

            if (testBenchRefCount == 0)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = this.parametricExploration.Impl,
                    Message = "Parametric exploration has no TestBenches, ExcelWrapper, PythonWrappers, or MATLABWrappers. There must be at least one."
                };

                results.Add(feedback);
            }

            foreach (var testBenchRef in allParametricExplorations.SelectMany(pe => pe.Children.TestBenchRefCollection))
            {
                // check test benches
                if (testBenchRef.Referred.TestBenchType == null)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = testBenchRef.Impl,
                        Message = "Test bench reference cannot be null."
                    };

                    results.Add(feedback);

                    continue;
                }
                else
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = testBenchRef.Impl,
                        Message = "Test bench reference is not null."
                    };

                    results.Add(feedback);
                }

                var testBench = testBenchRef.Referred.TestBenchType;

                // testbench ref is NOT null at this point
                ContextChecker testBenchChecker = ContextChecker.GetContextChecker(testBench.Impl as GME.MGA.MgaModel);

                testBenchChecker.TryCheck();

                results.AddRange(testBenchChecker.Details);
            }

            return(results);
        }
Beispiel #12
0
        /// <summary>
        /// Context is not a library element or subtype or instance or read-only.
        /// <para><remarks>Execute within transaction.</remarks></para>
        /// </summary>
        /// <returns>Checker results.</returns>
        protected IEnumerable <ContextCheckerResult> NotLibraryOrSubtypeOrInstanceOrReadOnly()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            var context = this.GetContext();

            if (context.IsLibObject)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = context,
                    Message = string.Format("{0} cannot be a library object.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = context,
                    Message = string.Format("{0} is not a library object.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }

            if (context.IsInstance)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = context,
                    Message = string.Format("{0} cannot be an instance.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = context,
                    Message = string.Format("{0} is not an instance.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }

            if (context.ArcheType != null)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = context,
                    Message = string.Format("{0} cannot be an subtype or instance.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = context,
                    Message = string.Format("{0} is not a subtype or instance.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }


            if (context.HasReadOnlyAccess())
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = context,
                    Message = string.Format("{0} cannot be read-only.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = context,
                    Message = string.Format("{0} is writable.", context.MetaBase.Name)
                };

                results.Add(feedback);
            }

            return(results);
        }
        /// <summary>
        /// TODO: description what we check...
        /// <para><remarks>Execute within transaction.</remarks></para>
        /// </summary>
        /// <returns>Checker results.</returns>
        protected IEnumerable <ContextCheckerResult> TopLevelSystemUnderTest()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            foreach (var tlsut in this.testBench.Children.TopLevelSystemUnderTestCollection)
            {
                if ((tlsut.Impl as GME.MGA.IMgaReference).Referred == null)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = tlsut.Impl,
                        Message = "TopLevelSystemUnderTest object is null reference."
                    };

                    results.Add(feedback);
                }
                else
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = tlsut.Impl,
                        Message = "TopLevelSystemUnderTest object is not a null reference."
                    };

                    results.Add(feedback);
                }
            }

            var tlsutCount = this.testBench.Children.TopLevelSystemUnderTestCollection.Count();

            if (tlsutCount == 0)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = this.testBench.Impl,
                    Message = "No TopLevelSystemUnderTest object."
                };

                results.Add(feedback);
            }
            else if (tlsutCount == 1)
            {
                var tlsut        = this.testBench.Children.TopLevelSystemUnderTestCollection.FirstOrDefault();
                var tlsutRefered = tlsut.Referred.DesignEntity;

                if (tlsutRefered == null)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = tlsut.Impl,
                        Message = string.Format("TopLevelSystemUnderTest is null.")
                    };

                    results.Add(feedback);
                }
                else if (tlsutRefered is CyPhy.TestComponent ||
                         tlsutRefered is CyPhy.ComponentRef ||
                         tlsutRefered is CyPhy.Component)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = tlsut.Impl,
                        Message = string.Format("TopLevelSystemUnderTest cannot refer to a {0}.", tlsutRefered.Kind)
                    };

                    results.Add(feedback);
                }
                else
                {
                    if (tlsutRefered is CyPhy.ComponentAssembly)
                    {
                        var feedback = new ContextCheckerResult()
                        {
                            Success = true,
                            Subject = tlsut.Impl,
                            Message = string.Format("TopLevelSystemUnderTest refers to {0}.", tlsutRefered.Kind)
                        };

                        results.Add(feedback);
                    }
                    else if (tlsutRefered is CyPhy.DesignContainer)
                    {
                        var designContainer = tlsutRefered as CyPhy.DesignContainer;
                        var feedback        = new ContextCheckerResult()
                        {
                            Success = true,
                            Subject = tlsut.Impl,
                            Message = string.Format("TopLevelSystemUnderTest refers to {0} {1}.",
                                                    designContainer.Attributes.ContainerType,
                                                    designContainer.Kind)
                        };

                        results.Add(feedback);
                    }

                    if (tlsutRefered.Impl.ID == (tlsutRefered.Impl as GME.MGA.MgaModel).RootFCO.ID)
                    {
                        var feedback = new ContextCheckerResult()
                        {
                            Success = true,
                            Subject = tlsutRefered.Impl,
                            Message = string.Format("'{0}' [TopLevelSystemUnderTest] refers to a valid object [{1}] and the {1} is in a folder.", tlsut.Name, tlsutRefered.Kind)
                        };

                        results.Add(feedback);
                    }
                    else
                    {
                        var feedback = new ContextCheckerResult()
                        {
                            Success = false,
                            Subject = tlsutRefered.Impl,
                            Message = string.Format("'{0}' [TopLevelSystemUnderTest] refers to a valid object [{1}] but the {1} is not in a folder.", tlsut.Name, tlsutRefered.Kind)
                        };

                        results.Add(feedback);
                    }
                }
            }
            else if (tlsutCount > 1)
            {
                foreach (var tlsut in this.testBench.Children.TopLevelSystemUnderTestCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = tlsut.Impl,
                        Message = "Only one TopLevelSystemUnderTest object allowed."
                    };

                    results.Add(feedback);
                }
            }
            else
            {
                throw new NotImplementedException();
            }


            return(results);
        }
        /// <summary>
        /// TODO: description what we check...
        /// <para><remarks>Execute within transaction.</remarks></para>
        /// </summary>
        /// <returns>Checker results.</returns>
        protected IEnumerable <ContextCheckerResult> ValidateTestInjectionPoint(GME.MGA.IMgaReference tip)
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            CyPhy.TopLevelSystemUnderTest tlsut = null;
            if (this.testBench.Children.TopLevelSystemUnderTestCollection.Count() == 1)
            {
                // if there is only one tlsut we can check safely the Test injection point references, otherwise do not.
                tlsut = this.testBench.Children.TopLevelSystemUnderTestCollection.FirstOrDefault();
            }
            else
            {
                return(results);
            }

            var tipRefersTo = tip.Referred;

            if (tipRefersTo == null)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = tip,
                    Message = string.Format("{0} [{1}] object is null reference.", tip.Name, tip.Meta.Name)
                };

                results.Add(feedback);
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = tip,
                    Message = string.Format("{0} [{1}] object is not null reference.", tip.Name, tip.Meta.Name)
                };

                results.Add(feedback);


                // descendant of top level system under test

                var referred = (tlsut.Impl as GME.MGA.IMgaReference).Referred;
                if (referred != null &&
                    referred is GME.MGA.MgaModel)
                {
                    var visitedCAs = new HashSet <string>()
                    {
                        referred.ID
                    };
                    var referenceFilter = referred.Project.CreateFilter();
                    referenceFilter.Kind = typeof(CyPhy.ComponentRef).Name;

                    var matchingTarget = this.LookForObjectIDInReferencedCAsRecursively(
                        referenceFilter,
                        referred.Project.CreateFilter(),
                        visitedCAs,
                        referred as GME.MGA.IMgaModel,
                        tip.Referred.ID);

                    if (matchingTarget == false)
                    {
                        // tip does not point to a descendant of the tlsut

                        feedback = new ContextCheckerResult()
                        {
                            Success = false,
                            Subject = tip,
                            Message = string.Format("{0} [{1}] does not point to a descendant of the TopLevelSystemUnderTest model.", tip.Name, tip.Meta.Name)
                        };

                        results.Add(feedback);
                    }
                    else
                    {
                        feedback = new ContextCheckerResult()
                        {
                            Success = true,
                            Subject = tip,
                            Message = string.Format("{0} [{1}] points to a descendant of the TopLevelSystemUnderTest model.", tip.Name, tip.Meta.Name)
                        };

                        results.Add(feedback);
                    }
                }

                if (tipRefersTo.Meta.Name == typeof(CyPhy.DesignContainer).Name)
                {
                    // can point to design container
                    var designContainer = CyPhyClasses.DesignContainer.Cast(tipRefersTo);

                    feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = tip,
                        Message = string.Format("{0} [{1}] can point to {2}.",
                                                tip.Name,
                                                tip.Meta.Name,
                                                designContainer.Attributes.ContainerType)
                    };

                    results.Add(feedback);
                }
                else if (tipRefersTo.Meta.Name == typeof(CyPhy.ComponentAssembly).Name)
                {
                    // can point to component assembly
                    feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = tip,
                        Message = string.Format("{0} [{1}] point can point to Component Assembly.", tip.Name, tip.Meta.Name)
                    };

                    results.Add(feedback);
                }
                else if (tipRefersTo.Meta.Name == typeof(CyPhy.Component).Name)
                {
                    // cannot point to component
                    feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = tip,
                        Message = string.Format("{0} [{1}] point cannot point to Component.", tip.Name, tip.Meta.Name)
                    };

                    results.Add(feedback);
                }
                else if (tipRefersTo.Meta.Name == typeof(CyPhy.ComponentRef).Name)
                {
                    var componentRef = CyPhyClasses.ComponentRef.Cast(tipRefersTo);

                    // can point to component ref
                    feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = tip,
                        Message = string.Format("{0} [{1}] can point to Component reference.", tip.Name, tip.Meta.Name)
                    };

                    results.Add(feedback);

                    if ((componentRef.Impl as GME.MGA.IMgaReference).Referred == null)
                    {
                        // component ref cannot be null
                        feedback = new ContextCheckerResult()
                        {
                            Success = false,
                            Subject = tip,
                            Message = string.Format("{0} [{1}] can point to Component reference, but the Component reference cannot be null.", tip.Name, tip.Meta.Name)
                        };

                        results.Add(feedback);
                    }
                    else
                    {
                        if (componentRef.AllReferred is CyPhy.TestComponent)
                        {
                            // component ref cannot be test component
                            feedback = new ContextCheckerResult()
                            {
                                Success = false,
                                Subject = tip,
                                Message = string.Format("{0} [{1}] can point to Component reference, but the Component reference cannot be a Test Component.", tip.Name, tip.Meta.Name)
                            };

                            results.Add(feedback);
                        }
                        else if (componentRef.AllReferred is CyPhy.Component)
                        {
                            // component ref can be component
                            feedback = new ContextCheckerResult()
                            {
                                Success = true,
                                Subject = tip,
                                Message = string.Format("{0} [{1}] can point to Component reference, which points to a Component.", tip.Name, tip.Meta.Name)
                            };

                            results.Add(feedback);
                        }
                        else if (componentRef.AllReferred is CyPhy.ComponentAssembly)
                        {
                            // component ref can be component assembly
                            feedback = new ContextCheckerResult()
                            {
                                Success = true,
                                Subject = tip,
                                Message = string.Format("{0} [{1}] can point to Component reference, which points to a Component Assembly.", tip.Name, tip.Meta.Name)
                            };

                            results.Add(feedback);
                        }
                        else
                        {
                            // this cannot happen, but if CyPhyML changes it may happen.
                            throw new NotImplementedException();
                        }
                    }
                }
            }

            return(results);
        }
        protected IEnumerable<ContextCheckerResult> TestBenchReferences()
        {
            List<ContextCheckerResult> results = new List<ContextCheckerResult>();

            var testBenchRefCount = this.parametricExploration.Children.TestBenchRefCollection.Count();

            if (testBenchRefCount == 0)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = this.parametricExploration.Impl,
                    Message = "Parametric exploration no test bench reference. It must have exactly one test bench reference."
                };

                results.Add(feedback);
            }
            else if (testBenchRefCount >= 1)
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = this.parametricExploration.Children.TestBenchRefCollection.FirstOrDefault().Impl,
                    Message = "One or more test bench reference found."
                };

                results.Add(feedback);
            }
            else
            {
                throw new NotImplementedException();
            }

            foreach (var testBenchRef in this.parametricExploration.Children.TestBenchRefCollection)
            {
                // check test benches
                if (testBenchRef.Referred.TestBenchType == null)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = testBenchRef.Impl,
                        Message = "Test bench reference cannot be null."
                    };

                    results.Add(feedback);

                    continue;
                }
                else
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = testBenchRef.Impl,
                        Message = "Test bench reference is not null."
                    };

                    results.Add(feedback);
                }

                var testBench = testBenchRef.Referred.TestBenchType;

                // testbench ref is NOT null at this point
                ContextChecker testBenchChecker = ContextChecker.GetContextChecker(testBench.Impl as GME.MGA.MgaModel);

                testBenchChecker.TryCheck();

                results.AddRange(testBenchChecker.Details);
            }

            return results;
        }
        private IEnumerable <ContextCheckerResult> AtLeastOneShotlineModelOrAPredefined()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            var hasShotline   = this.testBench.Children.ShotlineModelCollection.Any();
            var hasPredefined = this.testBench.Children.PredefinedBallisticSuiteCollection.Any();

            if (hasShotline || hasPredefined)
            {
                if (hasShotline && hasPredefined)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = this.testBench.Impl,
                        Message = "Test bench cannot have both ShotlineModel or PredefinedBallisticSuite."
                    };

                    results.Add(feedback);
                }
                else
                {
                    if (hasShotline)
                    {
                        var feedback = new ContextCheckerResult()
                        {
                            Success = true,
                            Subject = this.testBench.Impl,
                            Message = "Test bench has at least one ShotlineModel."
                        };

                        results.Add(feedback);
                    }

                    if (hasPredefined)
                    {
                        var feedback = new ContextCheckerResult()
                        {
                            Success = true,
                            Subject = this.testBench.Impl,
                            Message = "Test bench has PredefinedBallisticSuite."
                        };

                        results.Add(feedback);
                    }
                }
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = this.testBench.Impl,
                    Message = "Test bench does not have any ShotlineModel or PredefinedBallisticSuite."
                };

                results.Add(feedback);
            }

            return(results);
        }
Beispiel #17
0
        protected IEnumerable <ContextCheckerResult> ExactlyOneSolverSettings()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            var calmWaterSolverCount      = this.testBench.Children.CalmWaterSolverSettingsCollection.Count();
            var waveResistanceSolverCount = this.testBench.Children.WaveResistanceSolverSettingsCollection.Count();
            var correlationSettingsCount  = this.testBench.Children.CorrelationSettingsCollection.Count();
            var hydrostaticsSolverCount   = this.testBench.Children.HydrostaticsSolverSettingsCollection.Count();

            if (calmWaterSolverCount + waveResistanceSolverCount + correlationSettingsCount + hydrostaticsSolverCount == 0)
            {
                string errorMessage = "Test bench has no solver settings. It must have of one solver settings CalmWaterSolverSettings, " +
                                      "WaveResistanceSolverSettings, CorrelationSettings or HydrostaticsSolverSettings. A HydrostaticsSolverSettings can " +
                                      "further be combined with one of the other types.";

                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = this.testBench.Impl,
                    Message = errorMessage
                };

                results.Add(feedback);
            }
            else if (calmWaterSolverCount + waveResistanceSolverCount + correlationSettingsCount + hydrostaticsSolverCount == 1)
            {
                foreach (var calmWaterSolver in this.testBench.Children.CalmWaterSolverSettingsCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = calmWaterSolver.Impl,
                        Message = string.Format("Test bench has exectly one solver settings: {0}.", calmWaterSolver.Kind)
                    };

                    results.Add(feedback);
                }

                foreach (var waveResistanceSolver in this.testBench.Children.WaveResistanceSolverSettingsCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = waveResistanceSolver.Impl,
                        Message = string.Format("Test bench has exectly one solver settings: {0}.", waveResistanceSolver.Kind)
                    };

                    results.Add(feedback);
                }

                foreach (var correlationSetting in this.testBench.Children.CorrelationSettingsCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = correlationSetting.Impl,
                        Message = string.Format("Test bench has exectly one solver settings: {0}.", correlationSetting.Kind)
                    };

                    results.Add(feedback);
                }

                foreach (var hydrostaticsSolver in this.testBench.Children.HydrostaticsSolverSettingsCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = hydrostaticsSolver.Impl,
                        Message = string.Format("Test bench has exectly one solver settings: {0}.", hydrostaticsSolver.Kind)
                    };

                    results.Add(feedback);
                }
            }
            else if (calmWaterSolverCount + waveResistanceSolverCount + correlationSettingsCount > 1)
            {
                string errorMessage = "Test bench can only have one solver setting of type CalmWaterSolverSettings, WaveResistanceSolverSettings and CorrelationSettings.";

                foreach (var calmWaterSolver in this.testBench.Children.CalmWaterSolverSettingsCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = calmWaterSolver.Impl,
                        Message = errorMessage
                    };

                    results.Add(feedback);
                }

                foreach (var waveResistanceSolver in this.testBench.Children.WaveResistanceSolverSettingsCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = waveResistanceSolver.Impl,
                        Message = errorMessage
                    };

                    results.Add(feedback);
                }

                foreach (var correlationSetting in this.testBench.Children.CorrelationSettingsCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = correlationSetting.Impl,
                        Message = errorMessage
                    };

                    results.Add(feedback);
                }
            }
            else if (hydrostaticsSolverCount > 1)
            {
                string errorMessage = "Test bench can only have one solver setting of type HydrostaticsSolverSettings.";

                foreach (var hydrostaticsSolver in this.testBench.Children.HydrostaticsSolverSettingsCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = hydrostaticsSolver.Impl,
                        Message = errorMessage
                    };

                    results.Add(feedback);
                }
            }
            else if ((calmWaterSolverCount + waveResistanceSolverCount + correlationSettingsCount) == 1 &&
                     hydrostaticsSolverCount == 1)
            {
                foreach (var hydrostaticsSolver in this.testBench.Children.HydrostaticsSolverSettingsCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = hydrostaticsSolver.Impl,
                        Message = string.Format("Test bench has one {0} and other solver-settings.", hydrostaticsSolver.Kind)
                    };

                    results.Add(feedback);
                }

                foreach (var calmWaterSolver in this.testBench.Children.CalmWaterSolverSettingsCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = calmWaterSolver.Impl,
                        Message = string.Format("Test bench has one HydrostaticsSolverSettings and a {0}.", calmWaterSolver.Kind)
                    };

                    results.Add(feedback);
                }

                foreach (var waveResistanceSolver in this.testBench.Children.WaveResistanceSolverSettingsCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = waveResistanceSolver.Impl,
                        Message = string.Format("Test bench has one HydrostaticsSolverSettings and a {0}.", waveResistanceSolver.Kind)
                    };

                    results.Add(feedback);
                }

                foreach (var correlationSetting in this.testBench.Children.CorrelationSettingsCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = correlationSetting.Impl,
                        Message = string.Format("Test bench has one HydrostaticsSolverSettings and a {0}.", correlationSetting.Kind)
                    };

                    results.Add(feedback);
                }
            }
            else
            {
                throw new NotImplementedException();
            }


            return(results);
        }
        protected IEnumerable <ContextCheckerResult> ExactlyOneDriver()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            var pccDriverCount      = this.parametricExploration.Children.PCCDriverCollection.Count();
            var optimizerCount      = this.parametricExploration.Children.OptimizerCollection.Count();
            var parameterStudyCount = this.parametricExploration.Children.ParameterStudyCollection.Count();


            if (pccDriverCount + optimizerCount + parameterStudyCount == 1)
            {
                foreach (var pccDriver in this.parametricExploration.Children.PCCDriverCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = pccDriver.Impl,
                        Message = string.Format("Test bench has exactly one driver: {0}.", pccDriver.Kind)
                    };

                    results.Add(feedback);
                }

                foreach (var optimizer in this.parametricExploration.Children.OptimizerCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = optimizer.Impl,
                        Message = string.Format("Test bench has exactly one driver: {0}.", optimizer.Kind)
                    };

                    results.Add(feedback);
                }

                foreach (var parameterStudy in this.parametricExploration.Children.ParameterStudyCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = parameterStudy.Impl,
                        Message = string.Format("Test bench has exactly one driver: {0}.", parameterStudy.Kind)
                    };

                    results.Add(feedback);
                }
            }
            else if (pccDriverCount + optimizerCount + parameterStudyCount > 1)
            {
                string errorMessage = "Parametric Exploration model must not have more than one driver: PCCDriver OR Optimizer OR ParameterStudy.";

                foreach (var pccDriver in this.parametricExploration.Children.PCCDriverCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = pccDriver.Impl,
                        Message = errorMessage
                    };

                    results.Add(feedback);
                }

                foreach (var optimizer in this.parametricExploration.Children.OptimizerCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = optimizer.Impl,
                        Message = errorMessage
                    };

                    results.Add(feedback);
                }

                foreach (var parameterStudy in this.parametricExploration.Children.ParameterStudyCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = parameterStudy.Impl,
                        Message = errorMessage
                    };

                    results.Add(feedback);
                }
            }
            else
            {
            }


            return(results);
        }
Beispiel #19
0
        protected IEnumerable <ContextCheckerResult> TestBenchReferences()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            // at least one test bench ref
            if (this.testBenchSuite.Children.TestBenchRefCollection.Any())
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = true,
                    Subject = this.testBenchSuite.Impl,
                    Message = "Test bench suite has at least one test bench reference."
                };

                results.Add(feedback);

                var ids = this.testBenchSuite
                          .Children
                          .TestBenchRefCollection
                          .Where(x => (x.Impl as GME.MGA.IMgaReference).Referred != null)
                          .Select(x => (x.Impl as GME.MGA.IMgaReference).Referred.ID)
                          .ToList();

                if (ids.Count != ids.Distinct().Count())
                {
                    feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = this.testBenchSuite.Impl,
                        Message = "One test bench can be used only once. Remove the duplicates."
                    };

                    results.Add(feedback);
                }
                else
                {
                    feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = this.testBenchSuite.Impl,
                        Message = "Each test bench used only once."
                    };

                    results.Add(feedback);
                }
            }
            else
            {
                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = this.testBenchSuite.Impl,
                    Message = "Test bench suite has no test bench reference. It must have at least one test bench reference."
                };

                results.Add(feedback);
            }

            CyPhy.DesignEntity designEntity = null;

            // no null refs
            foreach (var testBenchRef in this.testBenchSuite.Children.TestBenchRefCollection)
            {
                // check test benches
                if (testBenchRef.AllReferred == null)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = testBenchRef.Impl,
                        Message = "Test bench reference cannot be null."
                    };

                    results.Add(feedback);

                    continue;
                }
                else if ((testBenchRef.AllReferred is CyPhy.TestBenchType) == false)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = testBenchRef.Impl,
                        Message = "Currently only Test Bench Types are allowed."
                    };

                    results.Add(feedback);

                    continue;
                }
                else
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = testBenchRef.Impl,
                        Message = "Test bench reference is not null."
                    };

                    results.Add(feedback);
                }

                var testBench = testBenchRef.AllReferred as CyPhy.TestBenchType;

                // testbench ref is NOT null at this point
                ContextChecker testBenchChecker = ContextChecker.GetContextChecker(testBench.Impl as GME.MGA.MgaModel);

                testBenchChecker.TryCheck();

                results.AddRange(testBenchChecker.Details);

                // check top level system under test pointers
                var tlsut = testBench.Children.TopLevelSystemUnderTestCollection.FirstOrDefault();

                if (tlsut != null &&
                    tlsut.Referred.DesignEntity != null)
                {
                    if (designEntity == null)
                    {
                        designEntity = tlsut.Referred.DesignEntity;
                    }
                    else
                    {
                        if (designEntity.Impl.ID == tlsut.Referred.DesignEntity.ID)
                        {
                            var feedback = new ContextCheckerResult()
                            {
                                Success = true,
                                Subject = testBenchRef.Impl,
                                Message = "Test bench is defined for the same design or design space."
                            };

                            results.Add(feedback);
                        }
                        else
                        {
                            var feedback = new ContextCheckerResult()
                            {
                                Success = false,
                                Subject = testBenchRef.Impl,
                                Message = "Test bench does not point to the same design space."
                            };

                            results.Add(feedback);
                        }
                    }
                }
            }

            return(results);
        }
Beispiel #20
0
        protected IEnumerable <ContextCheckerResult> ExactlyOnePredefinedBlastSuiteOrOneBlastModel()
        {
            List <ContextCheckerResult> results = new List <ContextCheckerResult>();

            var predefinedBlastSuiteCount = this.testBench.Children.PredefinedBlastSuiteCollection.Count();
            var blastModelCount           = this.testBench.Children.BlastModelCollection.Count();


            if (predefinedBlastSuiteCount + blastModelCount == 0)
            {
                string errorMessage = "Test bench has no PredefinedBlastSuite OR BlastModel. Test bench must have either one PredefinedBlastSuite or one BlastModel.";

                var feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = this.testBench.Impl,
                    Message = errorMessage
                };

                results.Add(feedback);

                feedback = new ContextCheckerResult()
                {
                    Success = false,
                    Subject = this.testBench.Impl,
                    Message = errorMessage
                };

                results.Add(feedback);
            }
            else if (predefinedBlastSuiteCount + blastModelCount == 1)
            {
                foreach (var predefinedBlastSuite in this.testBench.Children.PredefinedBlastSuiteCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = predefinedBlastSuite.Impl,
                        Message = string.Format("Test bench has exectly one solver settings: {0}.", predefinedBlastSuite.Kind)
                    };

                    results.Add(feedback);
                }

                foreach (var blastModel in this.testBench.Children.BlastModelCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = true,
                        Subject = blastModel.Impl,
                        Message = string.Format("Test bench has exectly one solver settings: {0}.", blastModel.Kind)
                    };

                    results.Add(feedback);
                }
            }
            else if (predefinedBlastSuiteCount + blastModelCount > 1)
            {
                string errorMessage = "Test bench has more than one PredefinedBlastSuite/BlastModel. Test bench must have either one PredefinedBlastSuite or one BlastModel.";

                foreach (var predefinedBlastSuite in this.testBench.Children.PredefinedBlastSuiteCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = predefinedBlastSuite.Impl,
                        Message = errorMessage
                    };

                    results.Add(feedback);
                }

                foreach (var blastModel in this.testBench.Children.BlastModelCollection)
                {
                    var feedback = new ContextCheckerResult()
                    {
                        Success = false,
                        Subject = blastModel.Impl,
                        Message = errorMessage
                    };

                    results.Add(feedback);
                }
            }
            else
            {
                throw new NotImplementedException();
            }


            return(results);
        }