public void DeleteCustomerOnCardView() { NgMockE2EModule mockModule = new NgMockE2EModule(@" $httpBackend.whenGET(/^\/app\/partials\//).passThrough(); $httpBackend.whenGET(/^\/app\/views\//).passThrough(); $httpBackend.whenGET('\/api/dataservice/customersSummary?$top=10&$skip=0').respond( // status 200, // body [ { id:1, firstName:'Marcus', lastName:'HighTower', city:'Phoenix', state: { id:1, abbreviation:'AZ', name:' Arizona' }, orderCount:6, gender:'Male' }, { id:2, firstName:'Dan', lastName:'Wahlin', city:'Chandler', state:{ id:1, abbreviation:'AZ', name:' Arizona' }, orderCount:5, gender:'Male' } ], // headers { 'X-InlineCount': 2 } );" ); var ngDriver = new NgWebDriver(driver, mockModule); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); var customersPage = new CustomersPage(ngDriver); Assert.AreEqual(2, customersPage.GetCustomersCount()); Assert.AreEqual("Showing 2 of 2 total customers", customersPage.GetFooterText()); // Delete Dan (sorry...) customersPage.DeleteCustomer(2).ConfirmDelete(); Assert.AreEqual(1, customersPage.GetCustomersCount()); Assert.AreEqual("Showing 1 of 1 total customers", customersPage.GetFooterText()); // Fail! }
public void NoCustomersOnCardView() { NgMockE2EModule mockModule = new NgMockE2EModule(@" $httpBackend.whenGET(/^\/app\/partials\//).passThrough(); $httpBackend.whenGET(/^\/app\/views\//).passThrough(); $httpBackend.whenGET('\/api/dataservice/customersSummary?$top=10&$skip=0').respond( // status 200, // body [], // headers { 'X-InlineCount': 0 } );" ); var ngDriver = new NgWebDriver(driver, mockModule); ngDriver.Navigate().GoToUrl("http://localhost:58000/#/customers"); var customersPage = new CustomersPage(ngDriver); Assert.AreEqual(0, customersPage.GetCustomersCount()); Assert.AreEqual("No customers found", customersPage.GetFooterText()); }