Skip to content

Yakudo/StreamAbstractions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StreamAbstractions

A library that provides abstractions for testing code using System.IO.Stream and System.Net.Sockets.NetworkStream.

Usage

In .NET System.IO.Stream/System.Net.Sockets.NetworkStream classes do not implement any interfaces. This makes it impossible to mock them in order to test code relying on those classes.

This library provides an abstraction (interfaces) and wrapper-class for such scenario. Instead of using Stream/NetworkStream directly use provided interfaces (IStream/INetworkStream) in your code and wrap Stream into StreamWrapper and NetworkStream into INetworkStream.

IStream stream = new StreamWrapper(stream);
INetworkStream stream = new NetworkStreamWrapper(networkStream);

// Stream become IStream 
// NetworkStream become INetworkStream
// This way you can easily mock it and use in tests.

About

A library that provides abstractions for testing code using System.Net.Sockets.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages