Ejemplo n.º 1
0
        /// <summary>
        /// Write a description of the constraint to a MessageWriter
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteDescriptionTo(MessageWriter writer)
        {
            var description      = new DescriptionStructureHelper();
            var filterExpression = description.GetFilterExpression(Request.GetAllFilters());

            if (Expected.Count() == 1)
            {
                writer.WritePredicate(string.Format("find a {0} named '{1}' contained {2}",
                                                    description.GetTargetExpression(Request.Target),
                                                    Expected.First(),
                                                    filterExpression));
            }
            else
            {
                var expectationExpression = new StringBuilder();
                foreach (string item in Expected)
                {
                    expectationExpression.AppendFormat("<{0}>, ", item);
                }
                expectationExpression.Remove(expectationExpression.Length - 2, 2);

                writer.WritePredicate(string.Format("find the {0} named '{1}' contained {2}",
                                                    description.GetTargetPluralExpression(Request.Target),
                                                    expectationExpression.ToString(),
                                                    filterExpression));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Write a description of the constraint to a MessageWriter
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteDescriptionTo(MessageWriter writer)
        {
            var description      = new DescriptionStructureHelper();
            var filterExpression = description.GetFilterExpression(Command.Description.Filters.Where(f => f is CaptionFilter).Cast <CaptionFilter>());

            if (!string.IsNullOrEmpty(filterExpression))
            {
                filterExpression = string.Format(" contained {0}", filterExpression);
            }

            if (Expected.Count() == 1)
            {
                writer.WritePredicate(string.Format("find a {0} named '{1}'{2}.",
                                                    description.GetTargetExpression(Command.Description.Target),
                                                    Expected.First(),
                                                    filterExpression));
            }
            else
            {
                var expectationExpression = new StringBuilder();
                foreach (string item in Expected)
                {
                    expectationExpression.AppendFormat("<{0}>, ", item);
                }
                expectationExpression.Remove(expectationExpression.Length - 2, 2);

                writer.WritePredicate(string.Format("find the {0} named '{1}'{2}.",
                                                    description.GetTargetPluralExpression(Command.Description.Target),
                                                    expectationExpression.ToString(),
                                                    filterExpression));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Write a description of the constraint to a MessageWriter
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteDescriptionTo(MessageWriter writer)
        {
            var description = new DescriptionStructureHelper();
            var filterExpression = description.GetFilterExpression(Request.GetAllFilters());

            if (Expected.Count() == 1)
            {
                writer.WritePredicate(string.Format("find a {0} named '{1}' contained {2}",
                    description.GetTargetExpression(Request.Target),
                    Expected.First(),
                    filterExpression));
            }
            else
            {
                var expectationExpression = new StringBuilder();
                foreach (string item in Expected)
                    expectationExpression.AppendFormat("<{0}>, ", item);
                expectationExpression.Remove(expectationExpression.Length - 2, 2);

                writer.WritePredicate(string.Format("find the {0} named '{1}' contained {2}",
                    description.GetTargetPluralExpression(Request.Target),
                    expectationExpression.ToString(),
                    filterExpression));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Write a description of the constraint to a MessageWriter
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteDescriptionTo(MessageWriter writer)
        {
            if (Command != null)
            {
                var description       = new DescriptionStructureHelper();
                var notExpression     = description.GetNotExpression(true);
                var targetExpression  = description.GetTargetExpression(Command.Description.Target);
                var captionExpression = Expected;
                var filterExpression  = description.GetFilterExpression(Command.Description.Filters.Where(f => f.Target != Command.Description.Target)).Remove(0, 3);

                writer.WritePredicate(string.Format("find {0} {1} named '{2}' linked to {3}"
                                                    , notExpression
                                                    , targetExpression
                                                    , captionExpression
                                                    , filterExpression));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Write a description of the constraint to a MessageWriter
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteDescriptionTo(MessageWriter writer)
        {
            if (Request != null)
            {
                var description       = new DescriptionStructureHelper();
                var filterExpression  = description.GetFilterExpression(Request.GetAllFilters().Where(f => f.Target != Request.Target));
                var notExpression     = description.GetNotExpression(true);
                var targetExpression  = description.GetTargetExpression(Request.Target);
                var captionExpression = Expected;

                writer.WritePredicate(string.Format("find {0} {1} named '{2}' {3}"
                                                    , notExpression
                                                    , targetExpression
                                                    , captionExpression
                                                    , filterExpression));
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Write a description of the constraint to a MessageWriter
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteDescriptionTo(MessageWriter writer)
        {
            if (Command != null)
            {
                var description = new DescriptionStructureHelper();
                var filterExpression = description.GetFilterExpression(Command.Description.Filters.Where(f => f.Target != Command.Description.Target));
                var notExpression = description.GetNotExpression(true);
                var targetExpression = description.GetTargetExpression(Command.Description.Target);
                var captionExpression = Expected;

                writer.WritePredicate(string.Format("find {0} {1} named '{2}' {3}"
                            , notExpression
                            , targetExpression
                            , captionExpression
                            , filterExpression));
            }
        }