public void IncludeOnlyClassesAndStructs(Type type, bool expected) { ITypeFilter sut = new IsClassOrStruct(); // Act bool actual = sut.ExcludeType(type); // Assert Assert.Equal(expected, actual); }
public void ApplyFiltersCorrectly( IsClassOrStruct filter) { // Arrange Assembly assembly = typeof(IsClassOrStruct).GetTypeInfo().Assembly; List <Type> interfaceTypes = assembly.GetTypes().Where(t => t.GetTypeInfo().IsInterface).ToList(); // Confirm there are interfaces to exclude. Assert.NotEmpty(interfaceTypes); // Act List <Type> actualTypes = assembly.GetTypes(new[] { filter }).ToList(); // Assert Assert.NotEmpty(actualTypes); Assert.Equal(actualTypes.Count, actualTypes.Except(interfaceTypes).Count()); }
public void ApplyFiltersCorrectly( Assembly assembly, IsClassOrStruct filter) { // Arrange List<Type> interfaceTypes = assembly.GetTypes().Where(t => t.IsInterface).ToList(); // Confirm there are interfaces to exclude. Assert.NotEmpty(interfaceTypes); // Act List<Type> actualTypes = assembly.GetTypes(new[] { filter }).ToList(); // Assert Assert.NotEmpty(actualTypes); Assert.Equal(actualTypes.Count, actualTypes.Except(interfaceTypes).Count()); }
public void RemoveFiltersByType( IsClassOrStruct[] filtersToAdd, List<IFilter> filters, Mock<IArgumentNullExceptionFixture> fixtureMock) { // Arrange fixtureMock.SetupGet(f => f.Filters).Returns(filters); IFilter[] originalFilters = filters.ToArray(); // Act IArgumentNullExceptionFixture actual = fixtureMock.Object .AddFilters(filtersToAdd) .RemoveFilters(typeof(IsClassOrStruct)); // Asserts Assert.Same(fixtureMock.Object, actual); Assert.Equal(originalFilters.Length, filters.Count); Assert.False(originalFilters.Except(filters).Any()); }
public void ReturnName(IsClassOrStruct sut) { Assert.Equal("IsClassOrStruct", sut.Name); }