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 RouteValueDictionaryExtensions | |
{ | |
public static RouteValueDictionary FlattenEnumerablesForLink(this RouteValueDictionary routeValueDictionary) | |
{ | |
var result = new RouteValueDictionary(); | |
foreach (var key in routeValueDictionary.Keys) | |
{ | |
var value = routeValueDictionary[key]; |
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
$('table tr').on('focus', 'input,textarea', function(event) { | |
var $blurFrom = $(event.delegateTarget); | |
$blurFrom.css("background-color","yellow"); | |
$blurFrom.find("textarea[cols]").each(function(i, element) { | |
expandHeight($(element)); | |
}); | |
}); | |
$('table tr').on('focusout', 'input,textarea', function(event) { | |
var $blurFrom = $(event.delegateTarget); |
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 EventBus | |
{ | |
private Dictionary<Type, List<Action<IEvent>>> actions = new Dictionary<Type, List<Action<IEvent>>>(); | |
public void Listen<T>(Action<IEvent> callback) where T : IEvent | |
{ | |
if (!actions.ContainsKey(typeof(T))) | |
{ | |
actions.Add(typeof(T), new List<Action<IEvent>>()); |
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
[TestFixture] | |
public class when_removing_a_coupon | |
{ | |
[Test] | |
public void then_should_remove_the_coupon_from_the_session() | |
{ | |
// Arrange | |
var httpSessionStateBase = new Mock<HttpSessionStateBase>(); | |
var coupons = new Dictionary<int, Coupon>(); | |
httpSessionStateBase.SetupGet(session => session["PendingBuyerCoupons"]) |
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
using System.Web; | |
using System.Web.Mvc; | |
namespace KK.Store.DigitalCoupons.Web.Controllers | |
{ | |
public class ContentResolver : IContentResolver | |
{ | |
public string Resolve(string imageLocation, HttpRequestBase httpRequestBase) | |
{ | |
return new UrlHelper(httpRequestBase.RequestContext).Content(imageLocation); |
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
.chevron { | |
margin-top: 200px; | |
margin-left: 200px; | |
position: relative; | |
width: 100px; | |
height: 1px; | |
} | |
.chevron .left { | |
position: absolute; | |
background-color:red; |
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 ExampleController : Controller | |
{ | |
private readonly IConfigurationReader _configurationReader; | |
private readonly IHttpContextFactory _httpContextFactory; | |
public MaintenanceController(IConfigurationReader configurationReader, IHttpContextFactory httpContextFactory) | |
{ | |
_configurationReader = configurationReader; | |
_httpContextFactory = httpContextFactory; | |
} |
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 Misspellings | |
{ | |
public static string ToStrign(this object obj) | |
{ | |
return obj.ToString(); | |
} | |
} |
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
[TestFixture] | |
public class when_getting_the_a_connection | |
{ | |
[Test] | |
public void then_should_return_a_new_instance_of_an_odbc_connection() | |
{ | |
// Arrange | |
const string connectionString = "Server=Localhost;"; | |
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); | |
config.ConnectionStrings.ConnectionStrings.Remove("AS400ConnectionString"); |
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
[Test] | |
public void then_should_return_users() | |
{ | |
// Arrange | |
var reader = new ConfigurationReader(); | |
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); | |
string a = "A"; | |
string b = "B"; | |
config.AppSettings.Settings.Remove(a); | |
config.AppSettings.Settings.Remove(b); |
OlderNewer