Ejemplo n.º 1
0
        /// <summary>
        /// Handle a IResultSetService execute it and check if the result contains unique rows or not
        /// </summary>
        /// <param name="actual">An IResultSetService or a result-set</param>
        /// <returns>true, if the result-set has unique rows</returns>
        public override bool Matches(object actual)
        {
            if (actual is IResultSetService)
            {
                return Matches((actual as IResultSetService).Execute());
            }
            else if (actual is ResultSet)
            {
                actualResultSet = (ResultSet)actual;
                var result = Engine.Execute(actualResultSet);

                if (!result.AreUnique || Configuration.FailureReportProfile.Mode == FailureReportMode.Always)
                {
                    var factory = new DataRowsMessageFormatterFactory();
                    failure = factory.Instantiate(Configuration.FailureReportProfile, Engine is IndexEvaluator ? EngineStyle.ByIndex : EngineStyle.ByName);
                    failure.BuildDuplication(actualResultSet.Rows.Cast<DataRow>(), result);
                }

                if (result.AreUnique && Configuration?.FailureReportProfile.Mode == FailureReportMode.Always)
                    Assert.Pass(failure.RenderMessage());

                return result.AreUnique;
            }
            else
                throw new ArgumentException();

        }
Ejemplo n.º 2
0
        protected override IDataRowsMessageFormatter BuildFailure()
        {
            var factory = new DataRowsMessageFormatterFactory();
            var msg     = factory.Instantiate(Configuration.FailureReportProfile, EngineStyle.ByIndex);

            msg.BuildFilter(actualResultSet.Rows.Cast <DataRow>(), filterResultSet.Rows.Cast <DataRow>());
            return(msg);
        }
Ejemplo n.º 3
0
        protected virtual IDataRowsMessageFormatter BuildFailure()
        {
            var factory = new DataRowsMessageFormatterFactory();
            var msg     = factory.Instantiate(Configuration.FailureReportProfile, Engine.Style);

            msg.BuildComparaison(expectedResultSet.Rows.Cast <DataRow>(), actualResultSet.Rows.Cast <DataRow>(), result);
            return(msg);
        }