This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class DateSuffixHelper | |
{ | |
public static string FullDate(DateTime date) | |
{ | |
return date.ToString("%d") + DaySuffix(date.Day) + date.ToString(" MMMM yyyy"); | |
} | |
public static string FullDateIncDay(DateTime date) | |
{ | |
return date.ToString("dddd d") + DaySuffix(date.Day) + date.ToString(" MMMM yyyy"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class WebDriverExtensions | |
{ | |
public static void ClickElement(this IWebElement element, Drivers driverChoice) | |
{ | |
switch (driverChoice) | |
{ | |
case Drivers.InternetExplorer: | |
element.SendKeys("\n"); | |
break; | |
default: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CryptographyHelper | |
{ | |
public static string CalculateMD5Hash(string value) | |
{ | |
var md5 = MD5.Create(); | |
byte[] hash = md5.ComputeHash(Encoding.ASCII.GetBytes(value.Trim())); | |
var sb = new StringBuilder(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PasswordHash | |
{ | |
private const int SALT_BYTES = 24; | |
private const int HASH_BYTES = 24; | |
private const int PBKDF2_ITERATIONS = 1000; | |
private const int ITERATION_INDEX = 0; | |
private const int SALT_INDEX = 1; | |
private const int PBKDF2_INDEX = 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Serializable] | |
public class LoggedError | |
{ | |
public List<string> Errors { get; set; } | |
public string StackTrace { get; set; } | |
public LoggedError() { } | |
public LoggedError(Exception ex) | |
{ | |
InitErrorList(ex); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum SerializationType | |
{ | |
Xml, | |
Binary | |
} | |
public static class SerializationHelper | |
{ | |
/// <summary> | |
/// Serializes the target into a string of the type specified |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LocalisationHelper | |
{ | |
public static List<string> Cultures | |
{ | |
get { return new[] {"en-GB", "es"}.ToList(); } | |
} | |
public static string DefaultCulture | |
{ | |
get { return Cultures[0]; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract partial class BaseController : Controller | |
{ | |
private const string _langCookie = "lang"; | |
protected override void OnActionExecuting(ActionExecutingContext filterContext) | |
{ | |
SetCurrentCulture(); | |
base.OnActionExecuting(filterContext); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CollectionMinMaxLengthValidationAttribute : ValidationAttribute | |
{ | |
const string errorMessage = "{0} must contain at least {1} item(s)."; | |
const string errorMessageWithMax = "{0} must contain between {1} and {2} item(s)."; | |
int minLength; | |
int? maxLength; | |
public CollectionMinMaxLengthValidationAttribute(int min) | |
{ | |
minLength = min; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum Comparison | |
{ | |
IsEqualTo, | |
IsNotEqualTo | |
} | |
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] | |
public sealed class RegularExpressionIfAttribute : ValidationAttribute, IClientValidatable | |
{ | |
public string RegEx { get; private set; } |
OlderNewer