Пример #1
0
        public void CloseDependencyTest()
        {
            var mock = new Mock <IDisposable>();

            mock.Setup(p => p.Dispose());
            ApplicationContext context = new ApplicationContext();

            context.Resolvers.Add(Resolver.CreateSingleton(mock.Object));
            IDisposable value = context.Resolve <IDisposable>();

            Assert.AreEqual(mock.Object, value);
            mock.Verify(p => p.Dispose(), Times.Never);
            context.Close();
            mock.Verify(p => p.Dispose(), Times.Once);
        }
Пример #2
0
 protected override void OnExit(ExitEventArgs e)
 {
     UIApplication.Close();
     ApplicationContext.Close();
     base.OnExit(e);
 }
Пример #3
0
 protected override void OnStop()
 {
     Destroy();
     ServiceContext.Close();
     ApplicationContext.Close();
 }