コード例 #1
0
ファイル: AnalyzersFactory.cs プロジェクト: ywscr/NBi
        public IEnumerable <IRowsAnalyzer> Instantiate(EquivalenceKind kind)
        {
            var list = new List <IRowsAnalyzer>()
            {
                new KeyMatchingRowsAnalyzer()
            };

            switch (kind)
            {
            case EquivalenceKind.IntersectionOf:
                break;

            case EquivalenceKind.SubsetOf:
                list.Add(new UnexpectedRowsAnalyzer());
                break;

            case EquivalenceKind.SupersetOf:
                list.Add(new MissingRowsAnalyzer());
                break;

            case EquivalenceKind.EqualTo:
                list.Add(new MissingRowsAnalyzer());
                list.Add(new UnexpectedRowsAnalyzer());
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            return(list);
        }
コード例 #2
0
        public IEquivaler Instantiate(ISettingsResultSet settings, EquivalenceKind kind)
        {
            switch (settings)
            {
            case ISettingsSingleRowResultSet x: return(InstantiateSingleRow(x));

            case ISettingsResultSet x: return(InstantiateMultipleRows(x, kind));

            default: throw new ArgumentException();
            }
        }
コード例 #3
0
        public IEquivaler InstantiateMultipleRows(ISettingsResultSet settings, EquivalenceKind kind)
        {
            var factory   = new AnalyzersFactory();
            var analyzers = factory.Instantiate(kind);

            switch (settings)
            {
            case SettingsOrdinalResultSet x: return(new OrdinalEquivaler(analyzers, x));

            case SettingsNameResultSet x: return(new NameEquivaler(analyzers, x));

            default: throw new ArgumentException();
            }
        }
コード例 #4
0
        public IEquivaler Instantiate(ISettingsResultSet settings, EquivalenceKind kind)
        {
            if (settings is SettingsSingleRowResultSet)
            {
                return(new SingleRowEquivaler(settings as SettingsSingleRowResultSet));
            }
            else
            {
                var factory   = new AnalyzersFactory();
                var analyzers = factory.Instantiate(kind);

                if (settings is SettingsIndexResultSet)
                {
                    return(new IndexEquivaler(analyzers, settings as SettingsIndexResultSet));
                }

                else if (settings is SettingsNameResultSet)
                {
                    return(new NameEquivaler(analyzers, settings as SettingsNameResultSet));
                }
            }
            throw new ArgumentOutOfRangeException(nameof(settings));
        }