public void ProxyStillPassesOnTokenToMethod_WhenTimeoutsAreIgnored()
 {
     ConfigProvider.Instance.Set(IgnoreTimeoutsKey, true);
     var expectedResult = "test";
     var classToProxy = new CancellableWithIgnoredTimeout(expectedResult);
     var proxy = CommandInterceptor.CreateProxy<ICancellableIgnoredTimeout>(classToProxy);
     // If we pass CancellationToken.None to the proxy then it should pass a timeout tokem to the method call.
     var token = new CancellationTokenSource(500).Token;
     var result = proxy.CancellableMethod(token);
     Assert.True(classToProxy.CallMade);
     Assert.Equal(classToProxy.TokenRecievedFromProxy,token);
     Assert.Equal(expectedResult, result);
     ConfigProvider.Instance.Set(IgnoreTimeoutsKey, false);
 }
 public void ProxyPassesNoneToMethod_WhenTimeoutsIgnored()
 {
     ConfigProvider.Instance.Set(IgnoreTimeoutsKey,true);
     var expectedResult = "test";
     var classToProxy = new CancellableWithIgnoredTimeout(expectedResult);
     var proxy = CommandInterceptor.CreateProxy<ICancellableIgnoredTimeout>(classToProxy);
     // If we pass CancellationToken.None to the proxy then it should pass this along to the method call, rather than a CancellationToken with a timeout. This should
     // be the case because we've set the Command to ignore timeouts
     var result = proxy.CancellableMethod(CancellationToken.None);
     Assert.True(classToProxy.CallMade);
     Assert.Equal(classToProxy.TokenRecievedFromProxy, CancellationToken.None);
     Assert.Equal(expectedResult, result);
     ConfigProvider.Instance.Set(IgnoreTimeoutsKey, false);
 }
        public void ProxyStillPassesOnTokenToMethod_WhenTimeoutsAreIgnored()
        {
            ConfigProvider.Instance.Set(IgnoreTimeoutsKey, true);
            var expectedResult = "test";
            var classToProxy   = new CancellableWithIgnoredTimeout(expectedResult);
            var proxy          = CommandInterceptor.CreateProxy <ICancellableIgnoredTimeout>(classToProxy);
            // If we pass CancellationToken.None to the proxy then it should pass a timeout tokem to the method call.
            var token  = new CancellationTokenSource(500).Token;
            var result = proxy.CancellableMethod(token);

            Assert.True(classToProxy.CallMade);
            Assert.Equal(classToProxy.TokenRecievedFromProxy, token);
            Assert.Equal(expectedResult, result);
            ConfigProvider.Instance.Set(IgnoreTimeoutsKey, false);
        }
        public void ProxyPassesNoneToMethod_WhenTimeoutsIgnored()
        {
            ConfigProvider.Instance.Set(IgnoreTimeoutsKey, true);
            var expectedResult = "test";
            var classToProxy   = new CancellableWithIgnoredTimeout(expectedResult);
            var proxy          = CommandInterceptor.CreateProxy <ICancellableIgnoredTimeout>(classToProxy);
            // If we pass CancellationToken.None to the proxy then it should pass this along to the method call, rather than a CancellationToken with a timeout. This should
            // be the case because we've set the Command to ignore timeouts
            var result = proxy.CancellableMethod(CancellationToken.None);

            Assert.True(classToProxy.CallMade);
            Assert.Equal(classToProxy.TokenRecievedFromProxy, CancellationToken.None);
            Assert.Equal(expectedResult, result);
            ConfigProvider.Instance.Set(IgnoreTimeoutsKey, false);
        }