Example #1
0
        public static IProxyFactory CreateControlProxyFactory()
        {
            var logger = new Mock <ILogger>();
            var client = new SimulatedTransceiver(
                Constants.AsyncCoupler,
                logger.Object,
                ProxySubject.EchoValueConst);

            return(new ProxyFactory(Constants.ConnectionSettings, client, Constants.AsyncCoupler, logger.Object));
        }
Example #2
0
 public async Task Proxy_VoidTaskMethod()
 {
     var logger = new Mock <ILogger>();
     var client = new SimulatedTransceiver(
         Constants.AsyncCoupler,
         logger.Object,
         null);
     var proxyFactory = new ProxyFactory(Constants.ConnectionSettings, client, Constants.AsyncCoupler, logger.Object);
     var proxy        = proxyFactory.Create <IProxySubject>(Constants.ProxySettings);
     await proxy.VoidTaskMethod();
 }
Example #3
0
        public void Proxy_IgnoreParametersAtImplementation()
        {
            var array = new string[] { ProxySubject.EchoValueConst };
            var json  = Newtonsoft.Json.JsonConvert.SerializeObject(array);

            var logger = new Mock <ILogger>();
            var client = new SimulatedTransceiver(
                Constants.AsyncCoupler,
                logger.Object,
                json);
            var proxyFactory = new ProxyFactory(Constants.ConnectionSettings, client, Constants.AsyncCoupler, logger.Object);
            var proxySubject = proxyFactory.Create <IProxySubject>(Constants.ProxySettings);

            var methodResult = proxySubject.IgnoreParametersAtImplementation("param1", "param2");
        }
Example #4
0
        public void Proxy_PassStringParams_PassingArrayOfArgs_ResultIsCorrectValue()
        {
            var array = new string[] { ProxySubject.EchoValueConst };
            var json  = Newtonsoft.Json.JsonConvert.SerializeObject(array);

            var logger = new Mock <ILogger>();
            var client = new SimulatedTransceiver(
                Constants.AsyncCoupler,
                logger.Object,
                json);
            var proxyFactory = new ProxyFactory(Constants.ConnectionSettings, client, Constants.AsyncCoupler, logger.Object);
            var proxySubject = proxyFactory.Create <IProxySubject>(Constants.ProxySettings);

            var echoResult = proxySubject.PassStringParams(array);

            Assert.AreEqual(json, echoResult);
        }
Example #5
0
        public void Proxy_PassStringParams_PassingSingleArgIntoParamsMethod_ResultIsCorrectValue2()
        {
            var array = new string[] { ProxySubject.EchoValueConst };
            var json  = Newtonsoft.Json.JsonConvert.SerializeObject(array);

            var logger = new Mock <ILogger>();
            var client = new SimulatedTransceiver(
                Constants.AsyncCoupler,
                logger.Object,
                json);
            var proxyFactory = new ProxyFactory(Constants.ConnectionSettings, client, Constants.AsyncCoupler, logger.Object);
            var proxySubject = proxyFactory.Create <IProxySubject>(Constants.ProxySettings);

            var methodResult = proxySubject.PassStringParams(ProxySubject.EchoValueConst);

            Assert.AreEqual(json, methodResult);

            // shows that the result of json serialization is the same as passing an array or a single arg
            // just confirmation that the test code was written correctly
            //var subject = new ProxySubject();
            //var json1 = subject.PassStringParams(ProxySubject.EchoValueConst);
            //var json2 = subject.PassStringParams(array);
        }