This file contains hidden or 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 ConventionalEmailSource : IFieldValidationSource | |
{ | |
public IEnumerable<IFieldValidationRule> RulesFor(PropertyInfo property) | |
{ | |
if(property.Name.ToLower().Contains("email")) | |
{ | |
yield return new EmailFieldRule(); | |
} | |
} | |
} |
This file contains hidden or 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
var validator = Validator.BasicValidator(); |
This file contains hidden or 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 LoFiEndpoint | |
{ | |
public const string GET = "Input data"; | |
public const string SUCCESS = "Success"; | |
public LoFiInput get_lofi(LoFiInput input) | |
{ | |
// You could get fancier here and just create the GET from an actionsource | |
return input; | |
} |
This file contains hidden or 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 Person | |
{ | |
public string FirstName { get; set; } | |
public string LastName { get; set; } | |
public IEnumerable<Error> Errors { get; set; } | |
} | |
public class Error | |
{ | |
public string Code { get; set; } |
This file contains hidden or 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 AjaxContinuation SystemFailure(this AjaxContinuation continuation, Exception exception) | |
{ | |
continuation.Success = false; | |
continuation[EXCEPTION] = new AjaxException | |
{ | |
type = exception.GetType().Name, | |
message = exception.Message, | |
stacktrace = exception.StackTrace | |
}; | |
return continuation; |
This file contains hidden or 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
// "records-grid" is the id of the div | |
var grid = Driver.GridAction<Person>("records-grid"); | |
grid.Where(x => x.SSN).Is(ssn).ClickOnRow(); |
This file contains hidden or 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 Wait | |
{ | |
public static bool ForExpectedValue<T>(T expectation, Func<T> source, int millisecondPolling = 500, int timeoutInMilliseconds = 5000) | |
{ | |
var matched = Wait.Until(() => expectation.Equals(source()), millisecondPolling, timeoutInMilliseconds).WasSatisfied; | |
StoryTellerAssert.Fail(!matched, () => "Expected {0}, but was {1}".ToFormat(expectation, source())); | |
return true; | |
} |
This file contains hidden or 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 EmailGateway : IEmailGateway | |
{ | |
private readonly EmailSettings _settings; | |
public EmailGateway(EmailSettings settings) | |
{ | |
_settings = settings; | |
} | |
public void Send(MailMessage message) |
This file contains hidden or 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 EmailGateway : IEmailGateway | |
{ | |
private readonly EmailSettings _settings; | |
private readonly ILogger _logger; | |
public EmailGateway(EmailSettings settings, ILogger logger) | |
{ | |
_settings = settings; | |
_logger = logger; | |
} |
This file contains hidden or 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 BindingJsonExtensions | |
{ | |
public static void UseJsonBinding(this BehaviorChain chain) | |
{ | |
chain.ApplyConneg(); | |
chain.Output.AddFormatter<JsonFormatter>(); | |
chain.Input.ClearAll(); | |
chain.Input.Readers.Prepend(new NewtonSoftReaderNode(chain.InputType())); | |
} |