Skip to content

Instantly share code, notes, and snippets.

View djfr's full-sized avatar

David Rodrigues djfr

View GitHub Profile
namespace DevOpsFlex.Analyzers
{
using System.Diagnostics.Contracts;
using System.IO;
using System.Text.RegularExpressions;
/// <summary>
/// Wraps logic around Name, Version and generic regular expression lazy initializations to support
/// the package consolidation analyzer.
/// </summary>
namespace DevOpsFlex.Analyzers
{
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.IO;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
@djfr
djfr / MergeDiscard.ps1
Last active December 22, 2015 21:18
tf merge /discard PowerShell script
function ApplyMergeDiscard
{
[cmdletbinding(SupportsShouldProcess=$true)]
param
(
[Parameter(Mandatory=$true)]
[string] $LocalPath,
[Parameter(Mandatory=$true)]
[ValidateSet("MainIntoDev", "DevIntoMain")]
@djfr
djfr / PushSsrsJob.cs
Last active August 29, 2015 14:25
PowerShell commandlet example to send a message to a queue
namespace DevOpsFlex.PowerShell
{
using System.Management.Automation;
using Microsoft.ServiceBus.Messaging;
/// <summary>
/// Push-SsrsJob commandlet implementation.
/// </summary>
[Cmdlet(VerbsCommon.Push, "SsrsJob")]
public class PushSsrsJob : Cmdlet
param
(
[parameter(Mandatory=$true)]
[string]
$Xml,
[parameter(Mandatory=$true)]
[string]
$Xdt
)
@djfr
djfr / CastleTestExtensions.cs
Last active August 29, 2015 14:12
Castle Helper class for Unit Tests checking container practices
namespace UnitTests.Common
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.Core;
using Castle.MicroKernel;
using Castle.MicroKernel.Handlers;
using Castle.Windsor;
@djfr
djfr / gist:6932645
Last active December 25, 2015 06:29
namespace ILRetail.CRM.Tests.Performance
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using CRMPerformance.Data;
using Microsoft.VisualStudio.TestTools.WebTesting;
using Newtonsoft.Json;
[TestMethod]
public void Ensure_InsertDocument_FaultContracts_AreAllMapped()
{
var targetOperation = typeof (IDocumentService).GetMethod(
"InsertDocument",
new[]
{
typeof (string),
typeof (string)
});
public static class ContractCheckerExtension
{
public static string CheckFaultContractMapping<TContract, TEx1>(this MethodInfo method, Action<Mock<WcfService<TContract>>> action)
where TContract : class
where TEx1 : Exception
{
return method.CheckFaultContractMapping<TContract, TEx1, DummyException>(action);
}
public static string CheckFaultContractMapping<TContract, TEx1, TEx2>(this MethodInfo method, Action<Mock<WcfService<TContract>>> action)
@djfr
djfr / gist:6827866
Last active December 24, 2015 16:28
public class DocumentClient : IDocumentService
{
public string InsertDocument(string documentClass, string filePath)
{
using (var service = new WcfService<IDocumentService>())
{
return InsertDocument(documentClass, filePath, service);
}
}