Skip to content

Instantly share code, notes, and snippets.

@zvirja
zvirja / MyAutoDataAttribute.cs
Last active May 30, 2019 22:53
AutoDataAttribute implementation which allows to easily apply test-specific customization
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using AutoFixture;
using AutoFixture.Xunit2;
using Xunit;
using Xunit.Sdk;
namespace CustomMyDataAttributesDemo
public class DiagnosticsSubstitutionContext : ISubstitutionContext
{
[ThreadStatic]
private static IList<IArgumentSpecification> LastDequeuedList;
private static ConcurrentDictionary<IArgumentSpecification, ArgumentInfo> ArgumentInfos { get; } = new ConcurrentDictionary<IArgumentSpecification, ArgumentInfo>();
private class ArgumentInfo
{
public string CreationStack { get; }
public int DequeueCounter { get; set; }