Exemple #1
0
        public void Localizer_should_exclude_matchers_list()
        {
            var subj    = new SatisfyAllMatcher <double>(new EqualMatcher <double>(1.0));
            var failure = TestMatcherLocalizer.Failure(subj, 0.0);

            Assert.DoesNotContain("Matchers", failure.UserData.Keys);
        }
Exemple #2
0
        public void Matches_should_detect_empty_nominal_func()
        {
            var subj = new SatisfyAllMatcher <int[]>(
                Matchers.BeEmpty(),
                Matchers.HaveCount(1)
                );
            var val = subj.Matches(TestActual.Value(new int[0]));

            Assert.False(val);
        }
Exemple #3
0
        public void Matches_should_apply_all_nominal()
        {
            var subj = new SatisfyAllMatcher <int[]>(
                Matchers.BeEmpty(),
                Matchers.HaveCount(0)
                );
            var val = subj.Matches(TestActual.Value(new int[0]));

            Assert.True(val);
        }
Exemple #4
0
        public void Localizer_should_produce_correct_failure_nested_messages()
        {
            var subj      = new SatisfyAllMatcher <double>(new EqualMatcher <double>(1.0));
            var failure   = TestMatcherLocalizer.Failure(subj, 0.0);
            var exception = failure.ToException();

            var lines    = exception.Message.Split('\n').Select(t => t.Trim()).Take(2);
            var expected = new [] {
                "Expected to satisfy all:",
                "- be equal to 1",
            };

            Assert.Equal(expected, lines);
        }