Esempio n. 1
0
            public void ReturnsConstructorsWithWithExpectedAccessibility()
            {
                // Arrange
                var sut = new AccessibleMembers(source, Accessibility.ProtectedInternal);

                Constructor[] expected =
                {
                    new Constructor(ConstructorInfo(MethodAttributes.FamORAssem | MethodAttributes.Static)),
                    new Constructor(ConstructorInfo(MethodAttributes.FamORAssem | MethodAttributes.Static)),
                };

                Constructor[] all =
                {
                    new Constructor(ConstructorInfo(MethodAttributes.Public | MethodAttributes.Static)),
                    expected[0],
                    new Constructor(ConstructorInfo(MethodAttributes.Family | MethodAttributes.Static)),
                    expected[1],
                    new Constructor(ConstructorInfo(MethodAttributes.Private | MethodAttributes.Static)),
                };

                ConfiguredCall arrange = source.Constructors().Returns(all);

                // Act
                IEnumerable <Constructor> actual = sut.Constructors();

                // Assert
                Assert.Equal(expected, actual);
            }
Esempio n. 2
0
            internal void CombinesPrivateAndProtectedAccessibility(Accessibility first, Accessibility second, Accessibility combined)
            {
                var sut = new AccessibleMembers(new AccessibleMembers(source, first), second);

                Assert.Equal(combined, sut.Accessibility);
                Assert.Same(source, sut.Source);
            }
Esempio n. 3
0
            public void ReturnsFieldsWithWithExpectedAccessibility()
            {
                // Arrange
                var sut = new AccessibleMembers(source, Accessibility.ProtectedInternal);

                Field[] expected =
                {
                    new Field(FieldInfo(FieldAttributes.FamORAssem | FieldAttributes.Static)),
                    new Field(FieldInfo(FieldAttributes.FamORAssem | FieldAttributes.Static)),
                };

                Field[] all =
                {
                    new Field(FieldInfo(FieldAttributes.Public | FieldAttributes.Static)),
                    expected[0],
                    new Field(FieldInfo(FieldAttributes.Family | FieldAttributes.Static)),
                    expected[1],
                    new Field(FieldInfo(FieldAttributes.Private | FieldAttributes.Static)),
                };

                ConfiguredCall arrange = source.Fields().Returns(all);

                // Act
                IEnumerable <Field> actual = sut.Fields();

                // Assert
                Assert.Equal(expected, actual);
            }
Esempio n. 4
0
            public void ReturnsEventsWithWithExpectedAccessibilityOfAddMethod()
            {
                // Arrange
                var sut = new AccessibleMembers(source, Accessibility.ProtectedInternal);

                Event[] expected =
                {
                    new Event(EventInfo(MethodAttributes.FamORAssem | MethodAttributes.Static)),
                    new Event(EventInfo(MethodAttributes.FamORAssem | MethodAttributes.Static)),
                };

                Event[] all =
                {
                    new Event(EventInfo(MethodAttributes.Public | MethodAttributes.Static)),
                    expected[0],
                    new Event(EventInfo(MethodAttributes.Family | MethodAttributes.Static)),
                    expected[1],
                    new Event(EventInfo(MethodAttributes.Private | MethodAttributes.Static)),
                };

                ConfiguredCall arrange = source.Events().Returns(all);

                // Act
                IEnumerable <Event> actual = sut.Events();

                // Assert
                Assert.Equal(expected, actual);
            }
Esempio n. 5
0
            public void InitializesAccessiblityPropertyForUseInTests()
            {
                var sut = new AccessibleMembers(source, accessibility);

                Assert.Equal(accessibility, sut.Accessibility);
            }
Esempio n. 6
0
            public void InitializesIDecoratorSourcePropertyForSelectorAccessToEntireFilterChain()
            {
                IDecorator <IMembers> sut = new AccessibleMembers(source, accessibility);

                Assert.Same(source, sut.Source);
            }