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); }
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 MethodMustHaveVoidReturn() { var attribute = new ApplyByAttributeAttribute(); var ex = Assert.Throws <MappingException>(() => attribute.GetApplyMethods(typeof(FakeAggregateWithReturn))); Assert.Equal(Exceptions.AggregateApplyMethodMustHaveVoidReturn.FormatWith(typeof(FakeAggregateWithReturn), "OnFakeEvent"), ex.Message); }
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); }