Example #1
0
        public void TryInvokeMember_ViaBase_ThrowsRuntimeBinderException()
        {
            dynamic dynamic = new DynamicEventDispatcher <NotMatchingSignatures>(new NotMatchingSignatures());

            Assert.Throws <RuntimeBinderException>(() => dynamic.When(new DummyEvent {
            }, 4));
        }
Example #2
0
        public void Fallback_to_base()
        {
            dynamic dynamic = new DynamicEventDispatcher <WhenWithMultipleParameters>(new WhenWithMultipleParameters());

            Assert.IsEmpty(dynamic.SupportedEventTypes);
            Assert.Throws <RuntimeBinderException>(() => dynamic.When(new DummyEvent {
            }, 4));
        }
Example #3
0
        public void Init_OnlyNotSupportedEventTypes_SupportedEventTypesIsEmpty()
        {
            var dynamic = new DynamicEventDispatcher <OnlyNotSupportedEventTypes>(new OnlyNotSupportedEventTypes());

            Assert.IsEmpty(dynamic.SupportedEventTypes);
        }
 /// <summary>Initializes a new instance of the <see cref="AggregateRoot{TAggregate}"/> class.</summary>
 /// <param name="validator">
 /// A custom <paramref name="validator"/> to validate the aggregate.
 /// </param>
 protected AggregateRoot(IValidator <TAggregate> validator)
 {
     Validator = Guard.NotNull(validator, nameof(validator));
     Dynamic   = new DynamicEventDispatcher <TAggregate>((TAggregate)this);
 }
Example #5
0
        private static void AssertNoEventTypes <T>() where T : class, new()
        {
            var dynamic = new DynamicEventDispatcher <T>(new T());

            Assert.IsEmpty(dynamic.SupportedEventTypes);
        }
Example #6
0
        private static void AssertEventTypes <T>() where T : class, new()
        {
            var dynamic = new DynamicEventDispatcher <T>(new T());

            Assert.AreEqual(1, dynamic.SupportedEventTypes.Count);
        }
Example #7
0
        public void Non_public_methods()
        {
            dynamic dispatcher = new DynamicEventDispatcher <WhenWithSingleArgument>(new WhenWithSingleArgument());

            Assert.Catch <Detected>(() => dispatcher.When(new DummyEvent()));
        }