This class helps unit testing of modules that depend on VcClient.VC stream related functions. Instead of streams on remote server it creates files in local directory and overrides default API to emulate Cosmos workflow. This class is not thread-safe.

Examples

General usage:
CopyC#
// Initialize stream manager (using is required to destroy cosmos local directory after test)
// You can also consider to create this object once for test class.
// 
using (VirtualStreamManager streamManager = new VirtualStreamManager())
{
    VC.Override.Attach(streamManager);

    try
    {
        // Run tested method here, like
        // 
        MyClass.CreateReportSteams();

        // Manipulate streams
        // 
        streamManager.Delete("/my/stream");

        // Run other tested method
        // 
        MyClass.VerifyReportStreamsExist();

        ...
    }
    finally
    {
        VC.Override.Clear();
    }

    Assert.AreEqual(0, streamManager.OpenedStreams.Count);
}

Namespace: VcClient.Test
Assembly: VcClient (in VcClient.dll) Version: 1.0.0.0 (1.8.400.4142)

Syntax

C#
public class VirtualStreamManager : IDisposable
Visual Basic
Public Class VirtualStreamManager _
	Implements IDisposable
Visual C++
public ref class VirtualStreamManager : IDisposable

Inheritance Hierarchy

Object
  VcClient.Test..::..VirtualStreamManager

See Also