Programming Tips 💡
51.6K subscribers
67 photos
10 videos
30 files
354 links
Programming & AI:
Tips 💡
Articles 📕
Resources 👾
Design Patterns 💎
Software Principles

🇳🇱 Contact: @MoienTajik

🎯 Buy ads: https://telega.io/c/ProgrammingTip
Download Telegram
Pose 👥

Replace any .NET method (including static and non-virtual) with a delegate. 💎

It is similar to Microsoft Fakes but unlike it Pose is implemented entirely in managed code (Reflection Emit API).

Everything occurs at runtime and in-memory, no unmanaged Profiling APIs and no file system pollution with re-written assemblies.⚡️


Example Usage 🔥:

Shim static property getter
:

Shim dateTimeShim = Shim.Replace(() => DateTime.Now).With(() => new DateTime(2004, 4, 4));


Usage 👾:

// This block executes immediately
PoseContext.Isolate(() =>
{
// All code that executes within this block
// is isolated and shimmed methods are replaced

// Outputs "4/4/04 12:00:00 AM"
Console.WriteLine(DateTime.Now);
}, dateTimeShim);


https://t.me/pgimg/179

[ Github ] : github.com/tonerdo/pose


#CSharp #DotNet #Fake
@ProgrammingTip