Skip to content

sign42/SystemWrapper

 
 

Repository files navigation

* Concept of usage (building unit testable object graph):

{code}
var service = IoC.Get<SomeService>();

public class SomeService()
{
    ...

    public SomeService(IFile file, IAppDomainSystem appDomainSystem, IProcessSystem processSystem)
	{
	    _file = file;
		_appDomainSystem = appDomainSystem;
		_processSystem = processSystem;
	}

	public void Run()
	{
		if (file.Exists("Daemon.exe")
		{
		     processSystem.Start("Daemon.exe");
		}
		else if (file.Exists("Daemon.dll")
		{
		    var domain = appDomainSystem.CreateDomain("Daemon");
			dynamic daemon = domain.CreateInstanceAndUnwrap("Daemon.dll","Daemon");
			daemon.Start();
		}
		else new Daemon().Start();
	}
}
{code}

* Develop
SystemWrapper.sln:
Visual Studio 2010
Portable Library Tools (http://msdn.microsoft.com/en-us/library/gg597391.aspx) - to open portable version
ReSharper(or other test runner) - to run unit tests(NUnit)


SystemWrapper.Mono.sln:
Linux
MonoDevelop

* Obsolete and new methods

Methods obsolete in .NET 4.0 or .NET 3.5 are not implemented.
New .NET methods sometimes backported to 3.5 wrappers.


* Coverage
Total number of wraps: 52
Microsoft.Win32.Registry-> UnitWrappers.Microsoft.Win32.IRegistry : 100%
Microsoft.Win32.RegistryKey-> UnitWrappers.Microsoft.Win32.IRegistryKeySystem UnitWrappers.Microsoft.Win32.IRegistryKey : 60%
Microsoft.Win32.SafeHandles.SafeFileHandle-> UnitWrappers.Microsoft.Win32.SafeHandles.ISafeFileHandle : 90%
System.AppDomain-> UnitWrappers.System.IAppDomain UnitWrappers.System.IAppDomainSystem : 41%
System.ComponentModel.BackgroundWorker-> UnitWrappers.System.ComponentModel.IBackgroundWorker : 65%
System.Configuration.ConfigurationManager-> UnitWrappers.System.Configuration.IConfigurationManager : 81%
System.Console-> UnitWrappers.System.IConsole : 9%
System.Data.SqlClient.SqlCommand-> UnitWrappers.System.Data.SqlClient.ISqlCommand : 2%
System.Data.SqlClient.SqlConnection-> UnitWrappers.System.Data.SqlClient.ISqlConnection : 38%
System.Data.SqlClient.SqlDataReader-> UnitWrappers.System.Data.SqlClient.ISqlDataReader : 62%
System.DateTime-> UnitWrappers.System.IDateTimeSystem : 20%
System.Diagnostics.Process-> UnitWrappers.System.Diagnostics.IProcess UnitWrappers.System.Diagnostics.IProcessSystem : 56%
System.Diagnostics.ProcessStartInfo-> UnitWrappers.System.Diagnostics.IProcessStartInfo : 34%
System.Environment-> UnitWrappers.System.IEnvironment : 55%
System.IO.BinaryReader-> UnitWrappers.System.IO.IBinaryReader : 92%
System.IO.BinaryWriter-> UnitWrappers.System.IO.IBinaryWriter : 88%
System.IO.Compression.DeflateStream-> UnitWrappers.System.IO.Compression.IDeflateStream : 12%
System.IO.Directory-> UnitWrappers.System.IO.IDirectory : 77%
System.IO.DirectoryInfo-> UnitWrappers.System.IO.IDirectoryInfo : 54%
System.IO.File-> UnitWrappers.System.IO.IFile : 89%
System.IO.FileInfo-> UnitWrappers.System.IO.IFileInfo UnitWrappers.System.IO.IFileInfoSystem : 60%
System.IO.FileStream-> UnitWrappers.System.IO.IFileStream : 71%
System.IO.FileSystemWatcher-> UnitWrappers.System.IO.IFileSystemWatcher : 50%
System.IO.MemoryStream-> UnitWrappers.System.IO.IMemoryStream : 80%
System.IO.Path-> UnitWrappers.System.IO.IPath : 100%
System.IO.Stream-> UnitWrappers.System.IO.IStream : 58%
System.IO.StreamReader-> UnitWrappers.System.IO.IStreamReader : 44%
System.IO.StreamWriter-> UnitWrappers.System.IO.IStreamWriter : 42%
System.IO.TextReader-> UnitWrappers.System.IO.ITextReader : 61%
System.Management.ManagementObjectSearcher-> UnitWrappers.System.Management.IManagementObjectSearcher : 6%
System.Net.Sockets.Socket-> UnitWrappers.System.Net.Sockets.ISocket : 26%
System.Net.WebClient-> UnitWrappers.System.Net.IWebClient : 83%
System.Net.WebRequest-> UnitWrappers.System.Net.IWebRequestSystem : 9%
System.Reflection.Assembly-> UnitWrappers.System.Reflection.IAssemblySystem UnitWrappers.System.Reflection.IAssembly : 50%
System.Reflection.AssemblyName-> UnitWrappers.System.Reflection.IAssemblyName : 51%
System.Runtime.InteropServices.SafeHandle-> UnitWrappers.System.Runtime.InteropServices.ISafeHandle : 70%
System.Security.AccessControl.DirectorySecurity-> UnitWrappers.System.Security.AccessControl.IDirectorySecurity : 2%
System.Security.AccessControl.FileSecurity-> UnitWrappers.System.Security.AccessControl.IFileSecurity : 2%
System.Security.Permissions.FileIOPermission-> UnitWrappers.System.Security.Permissions.IFileIOPermission : 41%
System.ServiceModel.InstanceContext-> UnitWrappers.System.ServiceModel.IInstanceContext : 18%
System.ServiceModel.OperationContext-> UnitWrappers.System.ServiceModel.IOperationContext UnitWrappers.System.ServiceModel.IOperationContextSystem : 44%
System.ServiceModel.ServiceHost-> UnitWrappers.System.ServiceModel.IServiceHost : 18%
System.Threading.AutoResetEvent-> UnitWrappers.System.Threading.IAutoResetEvent : 30%
System.Threading.Mutex-> UnitWrappers.System.Threading.IMutexSystem UnitWrappers.System.Threading.IMutex : 32%
System.Threading.Tasks.Task-> UnitWrappers.System.Threading.Tasks.ITask : 18%
System.Threading.Thread-> UnitWrappers.System.Threading.IThread UnitWrappers.System.Threading.IThreadSystem : 33%
System.Threading.ThreadPool-> UnitWrappers.System.Threading.IThreadPool : 44%
System.Threading.WaitHandle-> UnitWrappers.System.Threading.IWaitHandle UnitWrappers.System.Threading.IWaitHandleSystem : 17%
System.Windows.Clipboard-> UnitWrappers.System.Windows.IClipboard : 100%
System.Windows.MessageBox-> UnitWrappers.System.Windows.IMessageBox : 100%
System.Windows.Threading.Dispatcher-> UnitWrappers.System.Windows.Threading.IDispatcherSystem UnitWrappers.System.Windows.Threading.IDispatcher : 97%
System.Windows.Threading.DispatcherTimer-> UnitWrappers.System.Windows.Threading.IDispatcherTimer : 50%