public void TeamProfilesController_Details_Test3() { // Initialization TeamProfilesController ctl = new TeamProfilesController(); // To test if it is null var result = ctl.Details(999); Assert.IsNotNull(result); // To test if it is a valid id var model = (HttpStatusCodeResult)result; Assert.AreEqual(404, model.StatusCode); }
public void TeamProfilesController_Index_Test1() { // Initialization TeamProfilesController ctl = new TeamProfilesController(); // To test if it is null var result = ctl.Index(); Assert.IsNotNull(result); // To test the number of the elements in the list var modelList = (List<ProfileIndexViewModel>)((ViewResult)result).Model; Assert.AreEqual(5, modelList.Count); }
public void TeamProfilesController_Details_Test2() { // Initialization TeamProfilesController ctl = new TeamProfilesController(); // To test if it is null var result = ctl.Details(21); Assert.IsNotNull(result); // To test if it is a valid id var model = (profile)((ViewResult)result).Model; Assert.IsNotNull(model); //var model = (HttpStatusCodeResult)result; //Assert.AreEqual(400, model.StatusCode); }
public async Task TeamProfilesController_Delete_Test3() { // Initialization TeamProfilesController ctl = new TeamProfilesController(); // To test if it is null var result = await ctl.Delete(1); Assert.IsNotNull(result); // To test if it is a valid id var model = (ProfileIndexViewModel)((ViewResult)result).Model; Assert.IsNotNull(model); }
public async Task TeamProfilesController_Delete_Test2() { // Initialization TeamProfilesController ctl = new TeamProfilesController(); // To test if it is null var result = await ctl.Delete(21); Assert.IsNotNull(result); // To test if it is a valid id Assert.IsInstanceOfType(result, typeof(HttpNotFoundResult)); var model = (HttpNotFoundResult)result; Assert.AreEqual(404, model.StatusCode); }
public async Task TeamProfilesController_Edit_Test4() { // Initialization TeamProfilesController ctl = new TeamProfilesController(); // To test if it is null var result = await ctl.Edit(1); var model = (ProfileIndexViewModel)((ViewResult)result).Model; model.teamProfile.name = "Anne"; var result2 = ctl.Edit(model); Assert.IsNotNull(result); }
public void TeamProfilesController_Create_Test2() { // Initialization TeamProfilesController ctl = new TeamProfilesController(); // To test if it is null var result = ctl.Create(); Assert.IsNotNull(result); // To test if its contents var model = (ProfileIndexViewModel)((ViewResult)result).Model; Assert.AreEqual(0, model.teamProfile.profile_id); Assert.IsNull(model.teamProfile.name); Assert.IsNull(model.teamProfile.detail); Assert.AreEqual(0, model.teamProfile.status); }
public void TeamProfilesController_Create_Test1() { // Initialization TeamProfilesController ctl = new TeamProfilesController(); // To test if it is null var result = ctl.Create(); Assert.IsNotNull(result); // To test if its contents var model = (ProfileIndexViewModel)((ViewResult)result).Model; Assert.AreEqual("~/Images/no_image.jpg", model.teamProfile.pic); }