コード例 #1
0
            public async Task ItInvokesOnStart()
            {
                // Arrange
                var host = new TestServiceHost();
                var container = CreateTestContainer();
                var service = new TestService(TestName, host);

                // Act
                await service.Start(container);

                // Assert
                Assert.True(service.WasStarted);
            }
コード例 #2
0
            public async Task ItConfiguresShutdownTokenToCallOnShutdown()
            {
                // Arrange
                var host = new TestServiceHost();
                var container = CreateTestContainer();
                var service = new TestService(TestName, host);
                await service.Start(container);

                // Act
                host.Shutdown();

                // Assert
                Assert.True(service.WasShutdown);
            }