Skip to content

Instantly share code, notes, and snippets.

View Kevin-Bronsdijk's full-sized avatar
😃
Happily writing code!

Kevin Bronsdijk Kevin-Bronsdijk

😃
Happily writing code!
View GitHub Profile
[Test]
public void Example3_GetProducts_WhenPassingAValidCategory_ThenShouldReturnProducts()
{
Given.AConcreteProductCatalogService.WhenBasedOnScenario(
Given.AProductCatalogRepository.WhenReturningProductsForCategory("ElectronicDevices"))
.When().GetProducts(Category.ElectronicDevices)
.Then().Should().NotBeNull().And.HaveCountGreaterThan(0);
}
[Test]
public void Example2_GetProducts_WhenPassingAValidCategory_ThenShouldReturnProducts()
{
// setup repository mock
var products = new List<Product>
{
new Product { Id = 1, Name = "Product 1" },
new Product { Id = 2, Name = "Product 2" }
};
[Test]
public void Example1_GetProducts_WhenPassingAValidCategory_ThenShouldReturnProducts()
{
// arrange act assert
Assert.IsTrue(GetProducts_WhenPassingAValidCategoryAndTheRepositoryIsAbleToReturnProducts_ThenShouldReturnProducts());
}
[Test]
public void Example1_GetProducts_WhenPassingAValidCategory_ThenShouldReturnProducts()
{
// arrange act assert
Assert.IsTrue(GetProducts_WhenPassingAValidCategoryAndTheRepositoryIsAbleToReturnProducts_ThenShouldReturnProducts());
}
class Package
{
[String]$id
[String]$version
[String]$targetFramework
[String]$path
}
function GatherPackageInfo([string]$path) {
$packages = @()
@Kevin-Bronsdijk
Kevin-Bronsdijk / Remove-Missing-Includes-csproj-2.ps1
Last active July 20, 2019 00:58
Remove Missing Includes within csproj file powershell
RemoveMissingInclude -path "D:\Projects\gtmetrix-net\src\WebTest\WebTest.csproj" | Out-File D:\Projects\gtmetrix-net\src\WebTest\WebTestClean.csproj
using System;
using System.Linq;
using System.Net;
using Polly;
using RestSharp;
public static void Run(TimerInfo myTimer, TraceWriter log)
{
int[] httpStatusCodesWorthRetrying = {408, 500, 502, 503, 504};
@Kevin-Bronsdijk
Kevin-Bronsdijk / create_object_from_json.cs
Created September 21, 2016 06:36
SQL Server and JSON and c#
internal static async Task<IDataResponse<TResponse>> BuildResponse<TResponse>(string message)
{
var response = new DataResponse<TResponse>();
if (!string.IsNullOrEmpty(message))
response.Body = await JsonConvert.DeserializeObjectAsync<TResponse>(message, SerializerSettings()).ConfigureAwait(false);
return response;
}
using System;
public static void Run(string myQueueItem, TraceWriter log)
{
log.Info($"C# Queue trigger function processed: {myQueueItem}");
// More custom code
}
@Kevin-Bronsdijk
Kevin-Bronsdijk / azure-functions-1.cs
Created August 23, 2016 06:21
Azure Functions devslice.net
#r "Newtonsoft.Json"
using System;
using System.Net;
using Newtonsoft.Json;
using GTmetrix;
using GTmetrix.Http;
using GTmetrix.Model;
public static async Task<object> Run(HttpRequestMessage req, TraceWriter log)