Skip to content

Instantly share code, notes, and snippets.

View philippdolder's full-sized avatar

Philipp Dolder philippdolder

View GitHub Profile
@philippdolder
philippdolder / Setup-Windows-Defender-Exclusions-Rider.ps1
Created January 6, 2020 00:48
Windows Defender configuration for JetBrains Rider
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string]
$RiderHome
)
function Update-WindowsDefenderForRider {
[CmdletBinding()]
param (
@philippdolder
philippdolder / FluentAssertionsContext.cs
Created April 24, 2019 19:50
FluentAssertions own extensions
namespace Gist
{
using FluentAssertions.Execution;
using Xunit;
public class MyCustomAssertionsFacts
{
[Fact]
public void DoesNotPrintContextNicely()
{
@philippdolder
philippdolder / FaultyExtensionMethodResolution.cs
Created April 24, 2019 07:40
Rider does not properly resolve more specific extension methods
namespace Rider
{
using System.Collections.Generic;
using System.Linq;
using Xunit;
public class FaultyExtensionMethodResolution
{
[Fact]
public void RiderResolvesWrongExtensionMethod()
namespace LinkedList
{
public class List<T> : IEnumerable<T>, IEnumerator<T>
{
public IEnumerator<T> GetEnumerator()
{
this.current = null;
return this;
}
@philippdolder
philippdolder / JsonTextDeserializerOnly.cs
Created September 28, 2015 15:35
NEventStore simple dumper
public class JsonTextDeserializerOnly : ISerialize
{
public void Serialize<T>(Stream output, T graph)
{
throw new NotSupportedException("serialization should not be required");
}
public T Deserialize<T>(Stream input)
{
if (typeof(T) == typeof(List<EventMessage>))
@philippdolder
philippdolder / HowCanIUseItProperly.cs
Last active August 29, 2015 14:19
FluentAssertions. Assert multiple exceptions.
// I would like to make sure, both exceptions are packed into the AggregateException
[TestMethod]
public void ShouldThrowAggregateException()
{
Action act = () =>
{
throw new AggregateException(new Exception(), new ArgumentException());
};
act.ShouldThrow<AggregateException>()
public static class MyCollectionAssertionExtensions
{
public static AndConstraint<StringCollectionAssertions> ContainMagic(this StringCollectionAssertions assertions)
{
Execute.Assertion
.ForCondition(assertions.Subject.As<MyType>().ContainsMagicString())
.FailWith("No, there's no magic");
return new AndConstraint<StringCollectionAssertions>(assertions);
}
@philippdolder
philippdolder / Collection Count
Created March 23, 2015 07:08
R# SSP: MsTest to FluentAssertions collection count
The expression in the code looks like this:
var list = new List<string>();
Assert.AreEqual(3, list.Count);
Search part of ssp:
Assert.AreEqual($expected$, $actual$.Count);
both variables match "exactly one argument". I've turned on "Match similar constructs"
Replace part of ssp:
@philippdolder
philippdolder / cmdlet.ps1
Last active August 29, 2015 14:10
git-tfs workflow
function Tfs-UpdateFeature {
[CmdletBinding()]
param ()
DynamicParam {
$RuntimeParameterDictionary = New-Object System.Management.Automation.RuntimeDefinedParameterDictionary
$FeatureParameter = New-DynamicParameter -ParameterName "Feature" -AllowedValues {(git branch --list) | ForEach-Object { $_.Substring(2) }} -Position 0 -Aliases @("b","f") -Mandatory
$BranchParameter = New-DynamicParameter -ParameterName "MainBranch" -AllowedValues {(git branch --list) | ForEach-Object { $_.Substring(2) }} -Position 1
@philippdolder
philippdolder / Not working
Created November 25, 2014 06:52
AutoMapper constructor
public class Test
{
[Fact]
public void MapChildViewModel()
{
Mapper.CreateMap<ViewModel, Dto>();
var childViewModel = new ChildViewModel
{
ChildId = 5,