Mercurial > silverbladetech
view Stocks/Stocks.Service.Tests.Unit/StockServiceTests.cs @ 3:ef54074d5285
Removed Ninject IoCmodule as no longer required
author | stevenh7776 stevenhollidge@hotmail.com |
---|---|
date | Mon, 20 Feb 2012 22:29:44 +0700 |
parents | 29ed98d659e9 |
children | 57f20ba55884 |
line wrap: on
line source
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Xunit; using Stocks.Common; using System.Threading.Tasks; using System.Threading; using System.Net; namespace Stocks.Service.Tests.Unit { public class StockServiceTests { [Fact] public void Service_IsActive_property() { var file = "../../../Stocks.Service/companyData.json"; var configurationService = new ConfigurationService(file); var webClientShim = new WebClientShim(new WebClient()); var service = new StocksService( configurationService, webClientShim); Assert.Equal(false, service.IsActive); using (var task = Task.Factory.StartNew(() => { service.Start(); Assert.Equal(true, service.IsActive); using (var task2 = Task.Factory.StartNew(() => Thread.Sleep(500))) { task2.Wait(); } service.Stop(); Assert.Equal(false, service.IsActive); })) { task.Wait(); } } } }