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.Runtime.CompilerServices; | |
using System.Threading.Tasks; | |
//// inspired by Stephen Toub's https://devblogs.microsoft.com/pfxteam/asynclazyt/ | |
/// <summary> | |
/// Provides support for async lazy initialization. | |
/// </summary> | |
/// <typeparam name="T">Specifies the type of element being lazily initialized.</typeparam> |
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
const isSubclassOf = function isSubclassOf(derived: any, base: any) { | |
const pair = [Reflect.getPrototypeOf(derived), base]; | |
const allKeys = pair.reduce( | |
(keys, instance) => keys.concat(Object.keys(instance)), | |
[] | |
); | |
const distinctKeys = new Set(allKeys); |
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
const sum: (...values: any[]) => number = (...values) => { | |
return values.reduce( | |
(total, val) => total + (isNaN(Number(val)) ? 0 : Number(val)) | |
); | |
}; | |
export { sum }; |
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
namespace MoqDemo.Tests | |
{ | |
using System; | |
using System.Web; | |
using System.Web.Mvc; | |
using System.Web.Routing; | |
using Moq; | |
using NUnit.Framework; | |
using HomeController = Controllers.HomeController; |
NewerOlder