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; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Security.Claims; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Http; | |
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.AspNetCore.Mvc.Filters; |
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 UpdateContentPage : Command | |
{ | |
ContentPage page; | |
public UpdateContentPage(ContentPage page) | |
{ | |
this.page = page; | |
} | |
public override void Execute(IDomainContextImpl context) |
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 interface IDomainContextImpl | |
{ | |
DbAccess DataContext { get; } | |
IDomainEventsManager DomainEvents { get; } | |
} |
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 SqlFu; | |
using DomainEvents; | |
namespace Auction.Web.Infrastructure | |
{ | |
public abstract class Command<TResult> | |
{ | |
public abstract TResult Execute(IDomainContextImpl context); | |
} |
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 GetOrderData : Query<OrderData> | |
{ | |
int bidId { get; set; } | |
public GetOrderData(int bidId) | |
{ | |
this.bidId = bidId; | |
} | |
public override OrderData Execute(DbAccess context) |
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 GetValidBidWithNoActiveOrders : Query<IEnumerable<Bid>> | |
{ | |
public override IEnumerable<Bid> Execute(DbAccess context) | |
{ | |
return context.Query<Bid>(@"SELECT Bid.* | |
FROM Bid LEFT OUTER JOIN | |
[Order] ON Bid.Id = [Order].Id | |
WHERE ([Order].Id IS NULL) AND (Bid.IsWinningBid = 1) AND (Bid.TimeStamp < @TimeStamp)", new { TimeStamp = (DateTime.UtcNow.Subtract(new TimeSpan(0,45,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 class SingleContentPage : Query<ContentPage> | |
{ | |
private string slug; | |
public SingleContentPage(string slug) | |
{ | |
this.slug = slug; | |
} | |
public override ContentPage Execute(DbAccess context) |
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 SqlFu; | |
namespace Auction.Web.Infrastructure | |
{ | |
public abstract class Query<T> | |
{ | |
public abstract T Execute(DbAccess context); | |
} | |
public abstract class Query |
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-Code "Solution framework_v*.WSP is installed in solution store" { | |
arrange { | |
$solutionName = "framework_v*.WSP" | |
} | |
act { | |
$solution = Get-SPSolution $solutionName # NOTE: mijn Get-SPSolution voor SharePoint 2007 ondersteunt wildcards! | |
} | |
assert { | |
Assert-That { $solution -ne $null } -FailMessage "Solution `"$solutionName`" not found in solution store" | |
Assert-That { $solution.Deployed } -FailMessage "Solution `"$solutionName`" is not deployed" |
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-Code "New-Guid outputs a Guid" { | |
act { | |
$guid = New-Guid | |
} | |
assert { | |
$guid -is [string] | |
New-Object Guid $guid | |
} |