Exemplo n.º 1
0
        public void SelectSingleEvent()
        {
            var events = new[]
            {
                CreateEventStub("Event", adder: CreateMethodStub(attributes: MethodAttributes.Assembly)),
                CreateEventStub("this event is removed because of its name"),
                CreateEventStub("Event", adder: CreateMethodStub(attributes: MethodAttributes.Public))
            };
            var bindingFlags = (BindingFlags)1;

            _bindingFlagsEvaluatorMock.Expect(mock => mock.HasRightAttributes(MethodAttributes.Assembly, bindingFlags)).Return(false);
            _bindingFlagsEvaluatorMock.Expect(mock => mock.HasRightAttributes(MethodAttributes.Public, bindingFlags)).Return(true);

            var result = _selector.SelectSingleEvent(events, bindingFlags, "Event", _someDeclaringType);

            _bindingFlagsEvaluatorMock.VerifyAllExpectations();
            Assert.That(result, Is.SameAs(events[2]));
        }