public void TestFindServices_EquiavalantToEnumerateServices() { var target = new DefaultServiceTypeLocator(); target.AddService(typeof(Service)); target.AddService(typeof(Service2)); Assert.That(target.FindServices(), Is.EqualTo(target.EnumerateServices())); }
public void TestClearServices_NonEmpty_Cleared() { var target = new DefaultServiceTypeLocator(); target.AddService(typeof(Service)); target.AddService(typeof(Service2)); target.ClearServices(); Assert.That(target.EnumerateServices().Count(), Is.EqualTo(0)); }
public void TestAddService_Twise_FirstIsSucceededAndSecondIsFailed() { var serviceType = typeof( Service ); var target = new DefaultServiceTypeLocator(); var result1 = target.AddService( serviceType ); var result2 = target.AddService( serviceType ); Assert.That( result1, Is.True ); Assert.That( result2, Is.False ); Assert.That( target.EnumerateServices().Count(), Is.EqualTo( 1 ) ); }
public void TestAddService_Twise_FirstIsSucceededAndSecondIsFailed() { var serviceType = typeof(Service); var target = new DefaultServiceTypeLocator(); var result1 = target.AddService(serviceType); var result2 = target.AddService(serviceType); Assert.That(result1, Is.True); Assert.That(result2, Is.False); Assert.That(target.EnumerateServices().Count(), Is.EqualTo(1)); }
static void Main(string[] args) { var config = new RpcServerConfiguration(); config.BindingEndPoint = new IPEndPoint(IPAddress.Loopback, 8089); config.PreferIPv4 = true; config.IsDebugMode = true; //UseFullMethodName is a property that if it is false allows you in the CLIENT to call the methods only by it's name, check example further. config.UseFullMethodName = false; var defaultServiceTypeLocator = new DefaultServiceTypeLocator(); //Methods is the class I created with all the methods to be called. defaultServiceTypeLocator.AddService(typeof(Methods)); config.ServiceTypeLocatorProvider = conf => defaultServiceTypeLocator; using (var server = new RpcServer(config)) { server.Start(); Console.ReadKey(); } }
public void TestAddService_Null() { Type serviceType = null; var target = new DefaultServiceTypeLocator(); target.AddService( serviceType ); }
public void TestAddService_IsNotMarkedWithRpcServiceAttribute() { Type serviceType = typeof( string ); var target = new DefaultServiceTypeLocator(); target.AddService( serviceType ); }
public void TestAddService_IsNotMarkedWithRpcServiceAttribute() { Type serviceType = typeof(string); var target = new DefaultServiceTypeLocator(); target.AddService(serviceType); }
public void TestAddService_Null() { Type serviceType = null; var target = new DefaultServiceTypeLocator(); target.AddService(serviceType); }
public void TestAddService_Once_Sucess() { var serviceType = typeof(Service); var target = new DefaultServiceTypeLocator(); var result = target.AddService(serviceType); Assert.That(result, Is.True); Assert.That(target.EnumerateServices().Count(), Is.EqualTo(1)); }
public void TestAddService_Once_Sucess() { var serviceType = typeof( Service ); var target = new DefaultServiceTypeLocator(); var result = target.AddService( serviceType ); Assert.That( result, Is.True ); Assert.That( target.EnumerateServices().Count(), Is.EqualTo( 1 ) ); }
public void TestRemoveService_SpecifyNonServiceType_JustFail() { var serviceType = typeof(Service); var target = new DefaultServiceTypeLocator(); target.AddService(serviceType); var result = target.RemoveService(typeof(object)); Assert.That(result, Is.False); Assert.That(target.EnumerateServices().Count(), Is.EqualTo(1)); }
public void TestRemoveService_Registerd_Success() { var serviceType = typeof(Service); var target = new DefaultServiceTypeLocator(); target.AddService(serviceType); var result = target.RemoveService(serviceType); Assert.That(result, Is.True); Assert.That(target.EnumerateServices().Count(), Is.EqualTo(0)); }
public void TestRemoveService_NotRegisterdNonEmpty_Fail() { var serviceType = typeof(Service); var target = new DefaultServiceTypeLocator(); target.AddService(serviceType); var result = target.RemoveService(typeof(Service2)); Assert.That(result, Is.False); Assert.That(target.EnumerateServices().Count(), Is.EqualTo(1)); }
public void TestRemoveService_Registerd_Success() { var serviceType = typeof( Service ); var target = new DefaultServiceTypeLocator(); target.AddService( serviceType ); var result = target.RemoveService( serviceType ); Assert.That( result, Is.True ); Assert.That( target.EnumerateServices().Count(), Is.EqualTo( 0 ) ); }
public void TestRemoveService_NotRegisterdNonEmpty_Fail() { var serviceType = typeof( Service ); var target = new DefaultServiceTypeLocator(); target.AddService( serviceType ); var result = target.RemoveService( typeof( Service2 ) ); Assert.That( result, Is.False ); Assert.That( target.EnumerateServices().Count(), Is.EqualTo( 1 ) ); }
public void TestClearServices_NonEmpty_Cleared() { var target = new DefaultServiceTypeLocator(); target.AddService( typeof( Service ) ); target.AddService( typeof( Service2 ) ); target.ClearServices(); Assert.That( target.EnumerateServices().Count(), Is.EqualTo( 0 ) ); }
public void TestRemoveService_SpecifyNonServiceType_JustFail() { var serviceType = typeof( Service ); var target = new DefaultServiceTypeLocator(); target.AddService( serviceType ); var result = target.RemoveService( typeof( object ) ); Assert.That( result, Is.False ); Assert.That( target.EnumerateServices().Count(), Is.EqualTo( 1 ) ); }
public void TestFindServices_EquiavalantToEnumerateServices() { var target = new DefaultServiceTypeLocator(); target.AddService( typeof( Service ) ); target.AddService( typeof( Service2 ) ); Assert.That( target.FindServices(), Is.EqualTo( target.EnumerateServices() ) ); }