public void InvalidArguments() { var aggregator = new AggregatorMock(); var validator = new AggregatorValidationDecorator(aggregator); Assert.Throws(typeof(AggregationException), () => validator.Get(new List <Person>(), new[] { "Ag" }, new[] { "Country" }, Aggregation)); Assert.Throws(typeof(AggregationException), () => validator.Get(new List <Person>(), new string[] {}, new[] { "Country" }, Aggregation)); Assert.Throws(typeof(AggregationException), () => validator.Get(new List <Person>(), null, new[] { "Country" }, Aggregation)); Assert.Throws(typeof(AggregationException), () => validator.Get(new List <Person>(), new[] { "Age" }, new string[] {}, Aggregation)); Assert.Throws(typeof(AggregationException), () => validator.Get(new List <Person>(), new[] { "Ag" }, null, Aggregation)); Assert.Throws(typeof(AggregationException), () => validator.Get(new List <Person>(), new string[] {}, new string[] {}, Aggregation)); Assert.Throws(typeof(AggregationException), () => validator.Get(new List <Person>(), null, null, Aggregation)); Assert.Throws(typeof(AggregationException), () => validator.Get(new List <Person>(), new[] { "Age", "Age" }, new[] { "Country" }, Aggregation)); Assert.Throws(typeof(AggregationException), () => validator.Get(new List <Person>(), new[] { "Age", "Country" }, new[] { "Country" }, Aggregation)); }
public void CommonCase() { var aggregator = new AggregatorMock(); var validator = new AggregatorValidationDecorator(aggregator); var result = validator.Get(new List <Person>(), new[] { "Age" }, new[] { "Country" }, Aggregation); Assert.Equal(result, aggregator.LastReturnValue); Assert.Equal(1, aggregator.CallCount); }