A primitive type is a number, bool, string or void.
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
/// <summary> | |
/// Speclight users like to see "Pending" steps (that throw NotImplementedException) as "skip" not "fail" | |
/// </summary> | |
public class SpecAttribute : FactAttribute | |
{ | |
protected override IEnumerable<ITestCommand> EnumerateTestCommands(IMethodInfo method) | |
{ | |
yield return new SkipIfNotImplemented(method); | |
} |
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
ALTER PROC sp_generate_inserts | |
( | |
@table_name varchar(776), -- The table/view for which the INSERT statements will be generated using the existing data | |
@target_table varchar(776) = NULL, -- Use this parameter to specify a different table name into which the data will be inserted | |
@include_column_list bit = 1, -- Use this parameter to include/ommit column list in the generated INSERT statement | |
@from varchar(800) = NULL, -- Use this parameter to filter the rows based on a filter condition (using WHERE) | |
@include_timestamp bit = 0, -- Specify 1 for this parameter, if you want to include the TIMESTAMP/ROWVERSION column's data in the INSERT statement | |
@debug_mode bit = 0, -- If @debug_mode is set to 1, the SQL statements constructed by this procedure will be printed for later examination | |
@owner varchar(64) = NULL, -- Use this parameter if you are not the owner of the table |
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
[Trait("Category", "Spike")] | |
public class OomBuilder | |
{ | |
const string StaticConverter = @" | |
public static {{To}} To{{To}}({{From}} src) | |
{ | |
return new {{To}} | |
{ | |
{{#each Matches}} | |
{{this}} = src.{{this}},{{/each}} |
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 TValue GetValueOrDefault<TKey, TValue> (this Dictionary<TKey, TValue> d, TKey key, TValue defaultValue = default(TValue)) | |
{ | |
TValue value; | |
return d.TryGetValue(key, out value) ? value : defaultValue; | |
} |
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
void WaitForMicroOutageToPass() //call this from your constructor | |
{ | |
if (!Database.Exists()) | |
{ | |
return; | |
} | |
var connection = Database.Connection; | |
for (int i = 0; i < 10; i++) | |
{ |
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
<Path Name="imageBarcodeEncoder" Fill="Black" Width="200" Height="200" Data="[set this from a GeometryBarcodeWriter]"/> |
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 MultiplexedOperationDispatcher | |
{ | |
static readonly Subject<Tuple<string, IObservable<Unit>>> Operations = new Subject<Tuple<string, IObservable<Unit>>>(); | |
static MultiplexedOperationDispatcher() | |
{ | |
Operations.GroupBy(x => x.Item1).Subscribe(g => g.Select(x => x.Item2).Concat().Subscribe()); | |
} | |
public static IObservable<T> DispatchedByLockKey<T>(this IObservable<T> source, string lockKey) |
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 IObservable<TResult> SelectMany<TSource, TResult>(this ObservableCollection<TSource> collection, Func<TSource, IObservable<TResult>> selector) | |
{ | |
return Observable.Create<TResult>(observer => | |
{ | |
// assume events are raised on the same thread (i.e. dispatcher), so we don't need a concurrent dictionary | |
var subscriptions = new Dictionary<TSource, IDisposable>(); | |
foreach (var source in collection) | |
{ | |
//subscribe selector to all items already in the collection |
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
extern alias rxu; //alias the xunit dll to "rxu" - Real X Unit | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Xml; | |
using TechTalk.SpecFlow; | |
namespace Xunit | |
{ | |
public class FactAttribute:rxu.Xunit.FactAttribute |