public void SalespersonControllerTest_GetAll() { SalespersonController controller = new SalespersonController(); var people = controller.Get(); Assert.AreNotEqual(0, people.ToList().Count); }
public void GetSalespersonNotFoundTest() { //Arrange var controller = new SalespersonController(); //Act IHttpActionResult result = controller.GetSalesperson(100); //Assert Assert.IsInstanceOfType(result, typeof(NotFoundResult)); }
public void SalespersonControllerTest_Get() { SalespersonController controller = new SalespersonController(); var person = controller.Get(1); const string name = "Mike"; Assert.AreEqual(name, person.Name); }
public SalespeopleView() { InitializeComponent(); obsPeople = new ObservableCollection <Salesperson>(); editedPeople = new ObservableCollection <Salesperson>(); controller = new SalespersonController(); obsPeople.CollectionChanged += ObsPeople_CollectionChanged; DataGrid.CellEditEnding += DataGrid_CellEditEnding; DataGrid.SelectedCellsChanged += DataGrid_SelectedCellsChanged; this.Loaded += SalespeopleView_Loaded; }
public void GetSalespersonByIdTest() { //Arrange var controller = new SalespersonController(); //Act IHttpActionResult result = controller.GetSalesperson(1); var contentResult = result as OkNegotiatedContentResult <Salesperson>; //Assert Assert.IsNotNull(contentResult); Assert.IsNotNull(contentResult.Content); Assert.AreEqual(1, contentResult.Content.Id); }
public void GetAllSalespersonsTest() { //Arrange var controller = new SalespersonController(); //Act IHttpActionResult result = controller.GetAllSalespersons(); var contentResult = result as OkNegotiatedContentResult <List <Salesperson> >; //Assert Assert.IsNotNull(contentResult); Assert.IsNotNull(contentResult.Content); Assert.AreEqual(10, contentResult.Content.Count); }
public void UpdateDistrictTest() { //Arrange var controller = new SalespersonController(); var testSalesperson = new Salesperson { Id = 10, Name = "Test Updated" }; //Act IHttpActionResult result = controller.PutSalesperson(testSalesperson); var contentResult = result as NegotiatedContentResult <Salesperson>; //Assert Assert.IsNotNull(contentResult); Assert.AreEqual(HttpStatusCode.Accepted, contentResult.StatusCode); Assert.IsNotNull(contentResult.Content); }
public DistrictsView() { InitializeComponent(); districtContext = new DistrictController(); salespersonContext = new SalespersonController(); editedDistricts = new ObservableCollection <District>(); this.Loaded += DistrictsView_Loaded; DataGrid.SelectedCellsChanged += DataGrid_SelectedCellsChanged; DataGrid.CellEditEnding += DataGrid_CellEditEnding; SecondarySalespersonDataGrid.SelectedCellsChanged += SecondarySalespersonDataGrid_SelectedCellsChanged; PrimarySalespersonNewComboBox.DropDownClosed += PrimarySalespersonNewComboBox_DropDownClosed; ReassignPrimarySalespersonComboBox.DropDownClosed += ReassignPrimarySalespersonComboBox_DropDownClosed; SecondarySalespersonComboBox.DropDownClosed += SecondarySalespersonComboBox_DropDownClosed; }
public void SalespersonControllerTest_POST_DELETE() { SalespersonController controller = new SalespersonController(); var person = new Salesperson() { Id = 0, Name = "Controller", LastName = "Test" }; controller.Post(person); person = controller.Get().ToList().SingleOrDefault(x => { return(x.Name.Equals(person.Name) && x.LastName.Equals(person.LastName)); }); controller.Delete(person.Id); }
private async Task <IEnumerable <Salesperson> > LoadPeople() { SalespersonController controller = new SalespersonController(); var people = await controller.GetAllAsync(); var converted = new List <Salesperson>(); foreach (var person in people.ToList()) { converted.Add(new Salesperson() { Id = person.Id, Name = person.Name, LastName = person.LastName }); } return(converted); }
public void SalespersonControllerTest_PUT() { SalespersonController controller = new SalespersonController(); var person = controller.Get(3); string nameOld = person.Name; string nameNew = "Watson"; person.Name = nameNew; controller.Put(person.Id, person); person = null; person = controller.Get(3); Assert.AreEqual(nameNew, person.Name); person.Name = nameOld; controller.Put(person.Id, person); }
public static SalespersonController Fixture() { SalespersonController controller = new SalespersonController(new SalespersonRepository(), "", new LoginView()); return(controller); }
public ShellViewModel() { api = new SalespersonController(); api.Endpoint = "http://localhost:50209/"; }
public SalespersonControllerTest() { controller = new SalespersonController(); controller.Endpoint = "http://localhost:50209/"; }
public static SalespersonController Fixture() { SalespersonController controller = new SalespersonController(new SalespersonRepository(), "", new LoginView()); return controller; }
public SalespersonControllerTest() { controller = new SalespersonController(); }