Permalink
Browse files

Added ImageUrlBuilder.ClearModifiers method for removing all modifier…

…s from an ImageUrlBuilder instance.
  • Loading branch information...
1 parent f99928d commit 3cb5aed585b2b9c05751738f201e6e30c16d023d @benfoster committed Jul 3, 2012
@@ -37,6 +37,23 @@ public class When_the_modifier_is_a_valid_function
}
}
+ [Subject("Clearing modifiers")]
+ public class Clearing_modifiers
+ {
+ public class When_the_url_builder_has_modifiers
+ {
+ Establish ctx = () => {
+ builder = new ImageUrlBuilder().AddModifier(s => s.ToUpper());
+ };
+
+ Because of = ()
+ => builder.ClearModifiers();
+
+ It Should_remove_all_modifiers = ()
+ => builder.BuildUrl("someimage.jpg").ShouldEqual("someimage.jpg"); // url not modified by modifiers
+ }
+ }
+
[Subject("Setting parameters")]
public class Setting_parameters
{
@@ -34,6 +34,14 @@ public ImageUrlBuilder AddModifier(Func<string, string> modifier)
}
/// <summary>
+ /// Clears all URL modifiers from this ImageUrlBuilder instance.
+ /// </summary>
+ public void ClearModifiers()
+ {
+ modifiers.Clear();
+ }
+
+ /// <summary>
/// Builds an ImageResizer image URL using the current configuration and assigned modifiers
/// </summary>
/// <param name="imagePath">The source path of the image</param>
@@ -65,7 +73,6 @@ public ImageUrlBuilder SetParameter(string parameterName, string parameterValue)
return this;
}
-
/// <summary>
/// Applies the current configuration to <paramref name="imagePath"/>
/// </summary>

0 comments on commit 3cb5aed

Please sign in to comment.