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
export function jsonToPlain (obj) { | |
if (!obj) { | |
return '' | |
} | |
return Object.keys(obj).map(key => { | |
return key + '=' + encodeURIComponent(obj[key]) | |
}).join('&') | |
} | |
export function jsonToQueryParams (obj) { |
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.Collections.Generic; | |
using System.Net.Http; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace Tests | |
{ | |
public class FakeHttpMessageHandler : HttpMessageHandler | |
{ | |
public int CallCount; |
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 MockFactory | |
{ | |
public static Mock<T> CreateMock<T>() where T : class | |
{ | |
var ctorParams = typeof(T).GetConstructors().OrderByDescending(x => x.GetParameters().Length).First() | |
.GetParameters().Select<ParameterInfo, object>(x => null).ToArray(); | |
return new Mock<T>(ctorParams); | |
} | |
} |
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 byte[] ArrayCombine(byte[] arr1, byte[] arr2) | |
{ | |
var result = new byte[arr1.Length + arr2.Length]; | |
Buffer.BlockCopy(arr1, 0, result, 0, arr1.Length); | |
Buffer.BlockCopy(arr2, 0, result, arr1.Length, arr2.Length); | |
return result; | |
} |