public void ProcessCommand_HTTPBooksDetailIsWrong() { StringWriter output = new StringWriter(); ModelStore model = ModelMockup(); Viewer view = new Viewer(output); Controller control = new Controller(model, view); try { control.ProcessCommand("GET 1 http://www.nezarka.net/Books/Detail/1/test"); Assert.Fail("Expected exception was not thrown."); } catch(Exception ex) { Assert.AreEqual("Books HTTP address is wrong.", ex.Message); } }
public void ProcessCommand_CustomerNotExists() { StringWriter output = new StringWriter(); ModelStore model = ModelMockup(); Viewer view = new Viewer(output); Controller control = new Controller(model, view); try { control.ProcessCommand("GET 5 http://www.nezarka.net/Books"); Assert.Fail("Expected exception was not thrown."); } catch(Exception ex) { Assert.AreEqual("Customer doesn't exists.", ex.Message); } }
public void ProcessCommand_IncorrectLength() { StringWriter output = new StringWriter(); ModelStore model = ModelMockup(); Viewer view = new Viewer(output); Controller control = new Controller(model,view); try { control.ProcessCommand("GET http://www.nezarka.net/Books"); Assert.Fail("Expected exception was not thrown."); } catch(Exception ex) { Assert.AreEqual("Command length wrong.", ex.Message); } }
public void ProcessCommand_NotGet() { StringWriter output = new StringWriter(); ModelStore model = ModelMockup(); Viewer view = new Viewer(output); Controller control = new Controller(model, view); try { control.ProcessCommand("POST 1 http://www.nezarka.net/Books"); Assert.Fail("Expected exception was not thrown."); } catch(Exception ex) { Assert.AreEqual("Not a GET request.", ex.Message); } }
public void ProcessCommand_HTTPIsTooShort() { StringWriter output = new StringWriter(); ModelStore model = ModelMockup(); Viewer view = new Viewer(output); Controller control = new Controller(model, view); try { control.ProcessCommand("GET 1 http://www.nezarka.net/"); Assert.Fail("Expected exception was not thrown."); } catch(Exception ex) { Assert.AreEqual("HTTP address is too short.", ex.Message); } }