private static void Wait(MockService service, int ms, bool serviceShouldReceiveMsg) { if (!service._sync.WaitOne(ms)) { if (serviceShouldReceiveMsg) Assert.Fail("Service does not receive the message as expected"); } else { if (!serviceShouldReceiveMsg) Assert.Fail("Service shall not receive the message"); } }
static public MockService Start(Uri endpoint) { if (_host != null) Stop(); _service = new MockService(); _host = new ServiceHost(_service, new[] { endpoint }); _host.AddServiceEndpoint(typeof(IUsageTracking), new WSHttpBinding(), "UsageTracking"); _host.Open(); return _service; }