示例#1
0
        public void LocalizerCode_should_be_expected_value()
        {
            var subj    = new AndMatcher <string>(Matchers.BeEmpty(), Matchers.HaveCount(0));
            var failure = TestMatcherLocalizer.Failure(subj, "");

            Assert.Equal("spec.and", failure.Name.ToString());
        }
示例#2
0
        public void CalculatesLogicalConjunctionOfTwoMatchers()
        {
            for (int i = 0; i < truthTable.GetLength(0); i++)
            {
                Matcher matcher = new AndMatcher((Matcher)truthTable[i, 0], (Matcher)truthTable[i, 1]);

                Assert.AreEqual(truthTable[i, 2], matcher.Matches(ignored));
            }
        }
示例#3
0
        public void LocalizerFailure_should_generate_negated_children()
        {
            var subj      = new AndMatcher <string>(Matchers.BeEmpty(), Matchers.HaveCount(0));
            var failure   = TestMatcherLocalizer.Failure(Matchers.Not(subj), "");
            var exception = failure.ToException();

            var label = exception.Message.Split('\n').Select(t => t.Trim()).First();

            Assert.Equal("Not expected to:", label);
        }
示例#4
0
        public void LocalizerFailure_should_generate_children()
        {
            var subj      = new AndMatcher <string>(Matchers.BeEmpty(), Matchers.HaveCount(0));
            var failure   = TestMatcherLocalizer.Failure(subj, "");
            var exception = failure.ToException();

            var lines    = exception.Message.Split('\n').Select(t => t.Trim()).Take(3);
            var expected = new [] {
                "Expected to:",
                "- be empty",
                "- and have count 0",
            };

            Assert.Equal(expected, lines);
        }
示例#5
0
        public void Matches_should_detect_nominal()
        {
            var subj = new AndMatcher <string>(Matchers.BeEmpty(), Matchers.HaveCount(0));

            Assert.True(subj.Matches(TestActual.Value("")));
        }