Skip to content

Instantly share code, notes, and snippets.

View syed-afraz-ali's full-sized avatar

syed-afraz-ali

View GitHub Profile
@syed-afraz-ali
syed-afraz-ali / ExampleFeatures.cs
Created May 24, 2016 05:03
BDDfy examples feature usage
public class ExamplesUsage
{
private Int32 _initial;
private Int32 _eat;
[Given("Given there are <initial> cucumbers")]
private void Given(Int32 initial)
{
_initial = initial;
}
@syed-afraz-ali
syed-afraz-ali / SqlDataReaderExtensions.cs
Created February 15, 2016 04:23
Convert SqlDataReader to Json String
// Requires Newtonsoft.Json to create JSON String
public static String ToJson(this SqlDataReader rdr)
{
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
using (JsonWriter jsonWriter = new JsonTextWriter(sw))
{
jsonWriter.WriteStartArray();
@syed-afraz-ali
syed-afraz-ali / GetWeather.cs
Last active December 9, 2016 12:37
Simple CQRS using MediatR
using System;
using MediatR;
namespace MediatR_101
{
// The Query GetWeather that we will use to get weather status of any city
public class GetWeather : IRequest<Weather>
{
public GetWeather(String city)
{
@syed-afraz-ali
syed-afraz-ali / IoC.cs
Last active December 18, 2015 03:35
Configuring Structuremap in Console Applications
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
using MediatR;
using StructureMap;