public void GetProxyModuleTwiceReturnsSameProxyModule()
        {
            OnDemandProxyModule.Clear();
            var proxyModule = OnDemandProxyModule.GetProxyModule();

            Assert.That(proxyModule, Is.Not.Null);
            Assert.That(OnDemandProxyModule.GetProxyModule(), Is.SameAs(proxyModule));
        }
        public void ClearActionIsCalled()
        {
            bool called = false;

            OnDemandProxyModule.Clear();
            OnDemandProxyModule.AddClearAction(() => { called = true; });
            OnDemandProxyModule.Clear();
            Assert.That(called);
        }
        public void NoExceptionIsThrownWhenClearIsCalled()
        {
            var field = typeof(OnDemandProxyModule).GetField("_clearActions", BindingFlags.NonPublic | BindingFlags.Static);
            // ReSharper disable once PossibleNullReferenceException
            var value = field.GetValue(null);

            field.SetValue(null, null);
            OnDemandProxyModule.Clear();
            field.SetValue(null, value);
        }
        public void ClearActionIsCalledOnEveryClear()
        {
            int called = 0;

            OnDemandProxyModule.Clear();
            OnDemandProxyModule.AddClearAction(() => { ++called; });
            OnDemandProxyModule.Clear();
            OnDemandProxyModule.Clear();
            Assert.That(called, Is.EqualTo(2));
        }
        public void GetProxyModuleCreatesProxyModuleFromFactory()
        {
            OnDemandProxyModule.Clear();
            bool called = false;

            ProxyFooPolicies.ProxyModuleFactory = () =>
            {
                called = true;
                return(ProxyFooPolicies.DefaultProxyModuleFactory());
            };
            Assert.That(OnDemandProxyModule.GetProxyModule(), Is.Not.Null);
            Assert.That(called);
            ProxyFooPolicies.ProxyModuleFactory = ProxyFooPolicies.DefaultProxyModuleFactory;
        }
 public void GetProxyModuleReturnsProxyModule()
 {
     OnDemandProxyModule.Clear();
     Assert.That(OnDemandProxyModule.GetProxyModule(), Is.Not.Null);
 }