Introduction to InpcTracer - 9swampy/InpcTracer GitHub Wiki
Inspired by Seikilos
Published on NuGet
```csharp
tracer.WhileProcessing(() =>
{
target.Active = false;
target.Active = true;
})
.FirstRecordedEvent(() => target.Active)
.ThenRecordedEvent(() => target.Active);
```
Published on NuGet
I needed to clean up testing of INotifyPropertyChanged implementations in an application I'm working on. Seikilos' Gist inspired me, kudos. I use FakeItEasy and have altered the usage quite a bit by adopting their MustHave(Repeated) fluent syntax to be more consistent in-house.
The code is perfectly stable as far as our consumption has been concerned, but as it is used more the syntax may yet change. Hence it's only being published as a Beta as we may make significant changes. Please feel free to use it and send us your feedback.
```csharp ITraceable target = A.Fake(); A.CallTo(target).Where(x => x.Method.Name == "set_Active") .Invokes(() => { target.PropertyChanged += Raise.With(new PropertyChangedEventArgs("Active")).Now; });var tracer = new InpcTracer.InpcTracer(target);
<h5>
<b>Check for one event</b>
</h5>
```csharp
Assert.IsTrue(tracer.WhileProcessing(() => target.Active = true)
.RecordedEvent(() => target.Active)
.ExactlyOnce());
// or
tracer.WhileProcessing(() => target.Active = true)
.RecordedEvent(() => target.Active)
.MustHaveHappened(Repeated.Exactly.Once);