public void MethodNotMustHaveMultipleEventParameter()
            {
                var attribute = new ApplyByAttributeAttribute();
                var ex = Assert.Throws<MappingException>(() => attribute.GetApplyMethods(typeof(FakeAggregateWithMultipleParameters)));

                Assert.Equal(Exceptions.AggregateApplyMethodInvalidParameters.FormatWith(typeof(Event), typeof(FakeAggregateWithMultipleParameters), "OnFakeEvent"), ex.Message);
            }
            public void DoNotUseConventionBasedMapping()
            {
                var attribute = new ApplyByAttributeAttribute();
                var applyMethods = attribute.GetApplyMethods(typeof(FakeAggregateWithNoAttribute));

                Assert.Equal(0, applyMethods.Count);
            }
            public void MethodMustHaveVoidReturn()
            {
                var attribute = new ApplyByAttributeAttribute();
                var ex = Assert.Throws<MappingException>(() => attribute.GetApplyMethods(typeof(FakeAggregateWithReturn)));

                Assert.Equal(Exceptions.AggregateApplyMethodMustHaveVoidReturn.FormatWith(typeof(FakeAggregateWithReturn), "OnFakeEvent"), ex.Message);
            }
Example #4
0
            public void MethodNotMustHaveMultipleEventParameter()
            {
                var attribute = new ApplyByAttributeAttribute();
                var ex        = Assert.Throws <MappingException>(() => attribute.GetApplyMethods(typeof(FakeAggregateWithMultipleParameters)));

                Assert.Equal(Exceptions.AggregateApplyMethodInvalidParameters.FormatWith(typeof(Event), typeof(FakeAggregateWithMultipleParameters), "OnFakeEvent"), ex.Message);
            }
Example #5
0
            public void MethodMustHaveVoidReturn()
            {
                var attribute = new ApplyByAttributeAttribute();
                var ex        = Assert.Throws <MappingException>(() => attribute.GetApplyMethods(typeof(FakeAggregateWithReturn)));

                Assert.Equal(Exceptions.AggregateApplyMethodMustHaveVoidReturn.FormatWith(typeof(FakeAggregateWithReturn), "OnFakeEvent"), ex.Message);
            }
Example #6
0
            public void DoNotUseConventionBasedMapping()
            {
                var attribute    = new ApplyByAttributeAttribute();
                var applyMethods = attribute.GetApplyMethods(typeof(FakeAggregateWithNoAttribute));

                Assert.Equal(0, applyMethods.Count);
            }
Example #7
0
            public void PropagateSettingToApplyMethodCollection(Boolean applyOptional)
            {
                var attribute = new ApplyByAttributeAttribute {
                    ApplyOptional = applyOptional
                };
                var applyMethods = attribute.GetApplyMethods(typeof(FakeAggregate));

                Assert.Equal(applyOptional, applyMethods.ApplyOptional);
            }
Example #8
0
            public void MethodsMatchingCustomNameAreIncluded()
            {
                var attribute = new ApplyByAttributeAttribute {
                    PublicOnly = false
                };
                var applyMethods = attribute.GetApplyMethods(typeof(FakeAggregate));

                Assert.Equal(1, applyMethods.Count);
            }
Example #9
0
            public void MethodsNamedApplyAreIgnored()
            {
                var attribute = new ApplyByAttributeAttribute {
                    PublicOnly = true
                };
                var applyMethods = attribute.GetApplyMethods(typeof(FakeAggregate));

                Assert.Equal(0, applyMethods.Count);
            }
            public void PropagateSettingToApplyMethodCollection(Boolean applyOptional)
            {
                var attribute = new ApplyByAttributeAttribute { ApplyOptional = applyOptional };
                var applyMethods = attribute.GetApplyMethods(typeof(FakeAggregate));

                Assert.Equal(applyOptional, applyMethods.ApplyOptional);
            }
            public void MethodsMatchingCustomNameAreIncluded()
            {
                var attribute = new ApplyByAttributeAttribute { PublicOnly = false };
                var applyMethods = attribute.GetApplyMethods(typeof(FakeAggregate));

                Assert.Equal(1, applyMethods.Count);
            }
            public void MethodsNamedApplyAreIgnored()
            {
                var attribute = new ApplyByAttributeAttribute { PublicOnly = true };
                var applyMethods = attribute.GetApplyMethods(typeof(FakeAggregate));

                Assert.Equal(0, applyMethods.Count);
            }