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 interface IDomainEventDispatcher | |
{ | |
void Dispatch<TEvent>(TEvent eventToDispatch) where TEvent : IDomainEvent; | |
} | |
public static class DomainEvents | |
{ | |
public static IDomainEventDispatcher Dispatcher { get; set; } | |
public static void Raise<TEvent>(TEvent eventToRaise) where TEvent : IDomainEvent |
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
$(document).ready(function () { | |
var sortableList = $('.sortable-list').kendoSortable({ | |
hint: function(element){ | |
return element.clone().addClass('sortable-list-hint'); | |
}, | |
cursor: "n-resize" | |
}); | |
$('#sortable-submit').on('click', function (e) { |
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
using System; | |
using System.Data.SqlClient; | |
using System.IO; | |
using System.IO.Compression; | |
using System.Data.Entity.Migrations.Infrastructure; | |
using System.Xml.Linq; | |
using MyApplication.Migrations; | |
using NUnit.Framework; | |
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
/// <summary> | |
/// Special JsonConvert resolver that allows you to ignore properties. See http://stackoverflow.com/a/13588192/1037948 | |
/// </summary> | |
public class IgnorableSerializerContractResolver : DefaultContractResolver { | |
protected readonly Dictionary<Type, HashSet<string>> Ignores; | |
public IgnorableSerializerContractResolver() { | |
this.Ignores = new Dictionary<Type, HashSet<string>>(); | |
} |
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
using System.Net; | |
using System.Net.Http; | |
using System.Web; | |
using Moq; | |
using NUnit.Framework; | |
using MyApp.Tests.Stubs; | |
using MyApp.Web.Api.Infrastructure; | |
namespace MyApp.Tests.Web.Api.Infrastructure |
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
<?xml version="1.0" encoding="utf-8"?> | |
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> | |
<system.web> | |
<compilation xdt:Transform="RemoveAttributes(debug)" /> | |
<httpCookies httpOnlyCookies="true" requireSSL="true" lockItem="true" xdt:Transform="Replace" /> | |
<authentication mode="Forms"> | |
<forms loginUrl="~/Logon/LogOn" timeout="2880" requireSSL="true" xdt:Transform="Replace"/> | |
</authentication> | |
</system.web> |
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
using System; | |
using System.Web.Mvc; | |
public class RequreSecureConnectionFilter : RequireHttpsAttribute | |
{ | |
public override void OnAuthorization(AuthorizationContext filterContext) | |
{ | |
if (filterContext == null) | |
{ |
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
// Issue with this approach is when there is nothing is wrong with the solution and no actions are in the bad, i.e. test should pass | |
// this test still fail with error saying "No data found". | |
public class ControllerActionsDataAttribute : DataAttribute | |
{ | |
public override IEnumerable<object[]> GetData(MethodInfo methodUnderTest, Type[] parameterTypes) | |
{ | |
var controllerTypes = SitemapControllersTests.GetControllerTypes(); | |
var offendingActions = controllerTypes.Where(ct => !SitemapControllersTests.ExcludedControllers.Contains(ct)) | |
.SelectMany(c => c.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) |
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
[Theory, AutoDomainData] | |
public void FrozenObjects_AreInjected_IntoSut([Frozen]ILocationAddressRepository repository, | |
CreateLocationAddressCommandHandler sut, CreateLocationAddressCommand command) | |
{ | |
// Act | |
sut.Handle(command); | |
// Assert | |
repository.Received().Insert(Arg.Any<LocationAddress>()); | |
repository.Received().Save(); |
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 CreateLocationAddressCommandHandlerTests | |
{ | |
private IFixture fixture; | |
[SetUp] | |
public void SetUp() | |
{ | |
fixture = new Fixture().Customize(new AutofixtureOnboardCustomization()) | |
.Customize(new IgnoreVirtualMembersCustomisation()); |