Exemple #1
0
        public void StartReceive_Should_Throw_If_DataArrived_Has_No_Subscribers()
        {
            var descriptor = new ReceiveDescriptor(Mock.Of <IDescriptorContainer>());

            descriptor
            .Invoking(d => d.StartReceive())
            .ShouldThrow <InvalidOperationException>()
            .WithMessage(CommonStrings.ReceiveEventHasNoSubscribers);
        }
        public void StartReceive_Should_Throw_If_DataArrived_Has_No_Subscribers()
        {
            var descriptor = new ReceiveDescriptor(Mock.Of<IDescriptorContainer>());

            descriptor
                .Invoking(d => d.StartReceive())
                .ShouldThrow<InvalidOperationException>()
                .WithMessage(CommonStrings.ReceiveEventHasNoSubscribers);
        }
        public void DataArrived_Should_Throw_When_Delegate_Already_Bound()
        {
            var descriptor = new ReceiveDescriptor(Mock.Of<IDescriptorContainer>());
            descriptor.DataArrived += (o, e) => { };

            descriptor
                .Invoking(d => d.DataArrived += (o, e) => { })
                .ShouldThrow<InvalidOperationException>()
                .WithMessage(CommonStrings.EventMustHaveOnlyOneSubscriber);
        }
Exemple #4
0
        public void DataArrived_Should_Throw_When_Delegate_Already_Bound()
        {
            var descriptor = new ReceiveDescriptor(Mock.Of <IDescriptorContainer>());

            descriptor.DataArrived += (o, e) => { };

            descriptor
            .Invoking(d => d.DataArrived += (o, e) => { })
            .ShouldThrow <InvalidOperationException>()
            .WithMessage(CommonStrings.EventMustHaveOnlyOneSubscriber);
        }