public static void MutateRequiresContextThroughMutator() { var attribute = new ApplyMaxLengthAttribute(); Assert.True(attribute.RequiresContext); var exception = Assert.Throws <ArgumentNullException>("context", () => Mutator.Mutate <int>(null, new[] { attribute }) ); Assert.Equal($"A mutation context is required by this mutation attribute.{Environment.NewLine}Parameter name: context", exception.Message); }
public static void MutateTurncatesString(int maxLength, string output) { var attribute = new ApplyMaxLengthAttribute(); Assert.Equal(output, attribute.Mutate("1234567890", maxLength)); }