Example #1
0
        public async Task PingService_StartStop()
        {
            var cancellationTokenSource = new CancellationTokenSource();

            Assert.Equal(ServiceHostStatus.Stopped, _pingService.ServiceHostStatus);

            var startTask = _pingService.StartAsync(cancellationTokenSource.Token);

            startTask.Should().NotBeNull();

            Assert.Equal(ServiceHostStatus.Running, _pingService.ServiceHostStatus);
            await _pingService.StopAsync(cancellationTokenSource.Token);

            Assert.Equal(ServiceHostStatus.Stopped, _pingService.ServiceHostStatus);
        }