Exemplo n.º 1
0
        public void ExcludeCompilerGeneratedTypes(Type type, bool expected)
        {
            ITypeFilter sut = new NotCompilerGenerated();

            // Act
            bool actual = sut.ExcludeType(type);

            // Assert
            Assert.Equal(expected, actual);
        }
        public void ExcludeCompilerGeneratedTypes(Type type, bool expected)
        {
            ITypeFilter sut = new NotCompilerGenerated();

            // Act
            bool actual = sut.ExcludeType(type);

            // Assert
            Assert.Equal(expected, actual);
        }
        public void ExcludeCompilerGeneratedMethods(Type type, bool expected)
        {
            // Arrange
            ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes);
            IMethodFilter sut = new NotCompilerGenerated();

            // Act
            bool actual = sut.ExcludeMethod(type, constructor);

            // Assert
            Assert.Equal(expected, actual);
        }
Exemplo n.º 4
0
        public void ExcludeCompilerGeneratedMethods(Type type, bool expected)
        {
            // Arrange
            ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes);
            IMethodFilter   sut         = new NotCompilerGenerated();

            // Act
            bool actual = sut.ExcludeMethod(type, constructor);

            // Assert
            Assert.Equal(expected, actual);
        }
        public void ApplyFiltersCorrectly(
            Assembly assembly,
            NotCompilerGenerated filter)
        {
            // Arrange
            const BindingFlags bindingFlags             = ArgumentNullExceptionFixture.DefaultBindingFlags;
            List <MethodBase>  compilerGeneratedMethods =
                GetAllMethods(assembly, bindingFlags)
                .Where(m => m.IsCompilerGenerated())
                .ToList();

            // Confirm there are methods to exclude.
            Assert.NotEmpty(compilerGeneratedMethods);

            // Act
            List <MethodBase> actualMethods =
                (from type in assembly.GetTypes()
                 from method in type.GetMethods(bindingFlags, new[] { filter })
                 select method).ToList();

            // Assert
            Assert.NotEmpty(actualMethods);
            Assert.Equal(actualMethods.Count, actualMethods.Except(compilerGeneratedMethods).Count());
        }
        public void ApplyFiltersCorrectly(
            Assembly assembly,
            NotCompilerGenerated filter)
        {
            // Arrange
            const BindingFlags bindingFlags = ArgumentNullExceptionFixture.DefaultBindingFlags;
            List<MethodBase> compilerGeneratedMethods =
                GetAllMethods(assembly, bindingFlags)
                    .Where(m => m.IsCompilerGenerated())
                    .ToList();

            // Confirm there are methods to exclude.
            Assert.NotEmpty(compilerGeneratedMethods);

            // Act
            List<MethodBase> actualMethods =
                (from type in assembly.GetTypes()
                 from method in type.GetMethods(bindingFlags, new[] { filter })
                 select method).ToList();

            // Assert
            Assert.NotEmpty(actualMethods);
            Assert.Equal(actualMethods.Count, actualMethods.Except(compilerGeneratedMethods).Count());
        }
 public void ReturnName(NotCompilerGenerated sut)
 {
     Assert.Equal("NotCompilerGenerated", sut.Name);
 }
Exemplo n.º 8
0
 public void ReturnName(NotCompilerGenerated sut)
 {
     Assert.Equal("NotCompilerGenerated", sut.Name);
 }