Verifying that a Future Instance Was Created
You can verify whether a specific instance was created.
When to Use
When it is important that an instance was created.
Syntax
C# Isolate.Fake.NextInstance<Dependency>(); Isolate.Verify.WasCalledWithAnyArguments(() => new Dependency());
VB
Isolate.Fake.NextInstance(Of Dependency)()
Isolate.Verify.WasCalledWithAnyArguments(Function() New Dependency())
Samples
The following sample shows how to verify that a future instance was created.
C# [TestMethod, Isolated] public void Verify_AFutureInsance_WasCreated() { var fakeDependencyHandle = Isolate.Fake.NextInstance<Dependency>(); var dependancy1 = DependancyFactory.Create(); Isolate.Verify.WasCalledWithAnyArguments(() => new Dependency()); }
VB
<TestMethod, Isolated>
Public Sub Verify_AFutureInsance_WasCreated()
Dim fakeDependencyHandle = Isolate.Fake.NextInstance(Of Dependency)()
Dim dependancy1 = DependancyFactory.Create()
Isolate.Verify.WasCalledWithAnyArguments(Function() New Dependency())
End Sub