Exemple #1
0
 public AuthenticationInspector(bool validateUserLogin)
 {
     _validateUserLogin = validateUserLogin;
     InstanceProvider   = new UnityInstanceProvider {
         Container = UnityContainerManager.GetInstance
     };
 }
        public void ShouldCallToResolveWhenCallingToGetInstance()
        {
            var unityInstanceProvider = new UnityInstanceProvider(this.container, typeof(object));

            Assert.IsFalse(this.container.ResolveCalled);

            unityInstanceProvider.GetInstance(null, null);

            Assert.IsTrue(this.container.ResolveCalled);
        }
        public void ShouldCallToTeardownWhenCallingToReleaseInstance()
        {
            var unityInstanceProvider = new UnityInstanceProvider(this.container, typeof(object));

            var instance = new object();

            Assert.IsFalse(this.container.TeardownCalled);

            unityInstanceProvider.ReleaseInstance(null, instance);

            Assert.IsTrue(this.container.TeardownCalled);
            Assert.AreEqual(instance, this.container.TeardownArgument);
        }
Exemple #4
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var commonService = (ICommonService)UnityInstanceProvider.GetInstance(typeof(ICommonService));

            new MainWindow().ShowDialog();
        }
 public UnityAndErrorBehavior()
 {
     InstanceProvider = new UnityInstanceProvider {
         Container = UnityContainerManager.GetInstance
     };
 }