Exemplo n.º 1
0
        public void Should_register_multiple_event_listener()
        {
            // Arrange
            var doctor = new SecurityDoctor();
            ISecurityEventListener eventListener1 = new TestSecurityEventListener();
            ISecurityEventListener eventListener2 = new AnonymousSecurityEventListener(e => { });

            // Act
            doctor.RegisterListener(eventListener1);
            doctor.RegisterListener(eventListener2);

            // Assert
            Assert.That(doctor.Listeners.Count(), Is.EqualTo(2));
            Assert.That(doctor.Listeners.First(), Is.EqualTo(eventListener1));
            Assert.That(doctor.Listeners.Last(), Is.EqualTo(eventListener2));
        }
Exemplo n.º 2
0
        public void Should_register_event_listener()
        {
            // Arrange
            var doctor = new SecurityDoctor();
            ISecurityEventListener eventListener = new TestSecurityEventListener();

            // Act
            doctor.RegisterListener(eventListener);

            // Assert
            Assert.That(doctor.Listeners.Single(), Is.EqualTo(eventListener));
        }
Exemplo n.º 3
0
        public void Should_register_event_listener_using_the_static_method()
        {
            // Arrange
            SecurityDoctor.Reset();
            ISecurityEventListener eventListener = new TestSecurityEventListener();

            // Act
            SecurityDoctor.Register(eventListener);

            // Assert
            Assert.That(SecurityDoctor.Current.Listeners.Single(), Is.EqualTo(eventListener));
        }