Beispiel #1
0
        public void ShouldGetAll5Tests()
        {
            IArgumentNullExceptionFixture sut =
                new ArgumentNullExceptionFixture(typeof(OtherEquals).GetTypeInfo().Assembly)
                .ExcludeAllTypes()
                .IncludeType(typeof(OtherEquals));

            IEnumerable <MethodData> data = sut.GetData();

            Assert.Equal(5, data.Count());
        }
        public void ExcludeAllTypes(
            ExcludeAllAttribute sut,
            MethodInfo method)
        {
            // Arrange
            sut.ExclusionType = ExclusionType.Types;
            var fixture = new ArgumentNullExceptionFixture(GetType().Assembly);
            IArgNullExCustomization customization = sut.GetCustomization(method);

            // Act
            customization.Customize(fixture);
            IEnumerable<MethodData> data = fixture.GetData();

            // Assert
            Assert.Empty(data);
            IRegexFilter regexFilter = fixture.Filters.OfType<IRegexFilter>().Single();
            Assert.Equal(1, regexFilter.Rules.Count);
            AssertSingleExcludeAllTypesRule(regexFilter);
        }
        public void ExcludeAllMethods(
            ExcludeAllAttribute sut,
            MethodInfo method)
        {
            // Arrange
            sut.ExclusionType = ExclusionType.Methods;
            var fixture = new ArgumentNullExceptionFixture(GetType().GetTypeInfo().Assembly);
            IArgNullExCustomization customization = sut.GetCustomization(method);

            // Act
            customization.Customize(fixture);
            IEnumerable <MethodData> data = fixture.GetData();

            // Assert
            Assert.Empty(data);
            IRegexFilter regexFilter = fixture.Filters.OfType <IRegexFilter>().Single();

            Assert.Single(regexFilter.Rules);
            AssertSingleExcludeAllMethodsRule(regexFilter);
        }