示例#1
0
        public void should_not_match_not_inheritor([Values(null, "tag")] object tag)
        {
            var unitId = new UnitId(typeof(MemoryStream), tag);
            var target = new IsInheritorOf(typeof(IEnumerable), tag);

            target.Matches(unitId).Should().BeFalse();
        }
示例#2
0
        public void should_match_any_tag_if_specified([Values(null, "tag")] object tag)
        {
            var unitId = new UnitId(typeof(MemoryStream), tag);
            var target = new IsInheritorOf(typeof(Stream), SpecialTag.Any);

            target.Matches(unitId).Should().BeTrue();
        }
示例#3
0
        public void should_match_value_type_as_inheritor_of_object([Values(null, "tag")] object tag)
        {
            var unitId = new UnitId(typeof(int), tag);
            var target = new IsInheritorOf(typeof(object), tag);

            target.Matches(unitId).Should().BeTrue();
        }
示例#4
0
        public void should_match_interface([Values(null, "tag")] object tag)
        {
            var unitId = new UnitId(typeof(MemoryStream), tag);
            var target = new IsInheritorOf(typeof(IDisposable), tag);

            target.Matches(unitId).Should().BeTrue();
        }
示例#5
0
        public void should_not_match_exact_type([Values(null, "tag")] object tag)
        {
            var unitId = new UnitId(typeof(Stream), tag);
            var target = new IsInheritorOf(typeof(Stream), tag);

            target.Matches(unitId).Should().BeFalse();
        }
示例#6
0
        public void should_not_match_if_tag_differs([Values(null, "unitTag")] object unitTag, [Values(null, "patternTag")] object?patternTag)
        {
            if (Equals(unitTag, patternTag))
            {
                Assert.Ignore("Not the case");
            }

            var unitId = new UnitId(typeof(MemoryStream), unitTag);
            var target = new IsInheritorOf(typeof(Stream), patternTag);

            target.Matches(unitId).Should().BeFalse();
        }