Ejemplo n.º 1
0
        public void ProcesedMessageExceptionSequence_11()
        {
            var sut = new ServiceEvents();
            List<ProcesedMessageException> events = new List<ProcesedMessageException>();
            var elements = (104).Times<ProcesedMessageException>(new Func<ProcesedMessageException>(() =>
            {
                return new ProcesedMessageException(
                    Guid.NewGuid(),
                    StringExtension.RandomString(),
                    StringExtension.RandomString(),
                    StringExtension.RandomString(),
                    new ArgumentException()
                    );
            }));
            events.AddRange(elements);
            events.ForEach(e => sut.AddProcesedMessageException(e));
            sut.ProcesedMessageExceptionSequence.Subscribe(i =>
            {
                Assert.True(events.Contains(i));
                events.Remove(i);
            });

            Assert.Equal(events.Count, 94);
        }
Ejemplo n.º 2
0
 public void ProcesedMessageExceptionSequence()
 {
     var sut = new ServiceEvents();
     var callbackCalled = false;
     var message = new ProcesedMessageException(
         Guid.NewGuid(),
         StringExtension.RandomString(),
         StringExtension.RandomString(),
         StringExtension.RandomString(),
         new ArgumentException()
         );
     
     sut.ProcesedMessageExceptionSequence.Subscribe(i =>
     {
         Assert.Same(i, message);
         callbackCalled = true;
     });
     sut.AddProcesedMessageException(message);
     Assert.True(callbackCalled);
 }