public void Ctor_PassIncorrectUrl_ThrowsArgumentException() { // Assert Assert.Throws <ArgumentException>(() => new VocabularyServer( VocabularyRequestHandlerStabFactory.Stub(), "@#$$%%^&")); }
public void Ctor_PassNullUrl_ThrowsArgumentNullException() { // Assert Assert.Throws <ArgumentNullException>(() => new VocabularyServer( VocabularyRequestHandlerStabFactory.Stub(), null)); }
public void Start_DoItTwice_ThrowsApplicationException() { // Arrange using (var fisrtServer = new VocabularyServer(VocabularyRequestHandlerStabFactory.Stub(), Url)) { var start = fisrtServer.StartAsync(); using (var secondServer = new VocabularyServer(VocabularyRequestHandlerStabFactory.Stub(), Url)) { // Assert var ex = Assert.Throws <AggregateException>(() => secondServer.StartAsync().Wait()); Assert.IsInstanceOf <ApplicationException>(ex.InnerException); Assert.IsInstanceOf <HttpListenerException>(ex.InnerException.InnerException); } fisrtServer.Stop(); } }