public void ClinicHelper_ToSelectListItemsTests_Valid_Should_Pass() { // Arrange var data = DataSourceBackend.Instance.ClinicBackend.Index(); // Act var result = ClinicHelper.ToSelectListItems(data, null); // Reset // Assert // Check each item returned, and make sure it matches the original data foreach (var item in result) { Assert.AreEqual(item.Text, data.Find(m => m.ID == item.Value).Name); } }
public void ClinicHelper_ToSelectListItemsTests_InValid_Selected_Should_Pass() { // Arrange var data = DataSourceBackend.Instance.ClinicBackend.Index(); // Choose item to be selected var value = "bogus"; // Act var result = ClinicHelper.ToSelectListItems(data, value); var resultCount = result.Where(m => m.Selected == true).Count(); // Reset // Assert Assert.AreEqual(0, resultCount); }
public void ClinicHelper_ToSelectListItemsTests_Valid_Selected_Should_Pass() { // Arrange var data = DataSourceBackend.Instance.ClinicBackend.Index(); // Choose item to be selected var value = data[0].ID; // Act var result = ClinicHelper.ToSelectListItems(data, value); // Reset // Assert // The First should be the seleted item. Assert.AreEqual(result.First(m => m.Selected == true).Value, data.Find(m => m.ID == value).ID); // Only One should be Selected Assert.AreEqual(1, result.Where(m => m.Selected == true).Count()); }
public IActionResult Update(string id) { //Look up the ID var data = Backend.Read(id); if (data == null) { return(NotFound()); } ViewData["ResultLogIDList"] = ResultLogHelper.ToSelectListItems(Backend.Index(), null); ViewData["ClinicIDList"] = ClinicHelper.ToSelectListItems(ClinicData.Index(), null); ViewData["PhoneIDList"] = PhoneHelper.ToSelectListItems(PhoneData.Index(), null); ViewData["UserIDList"] = TechnicianHelper.ToSelectListItems(UserData.Index(), null); ViewData["PhotoIDList"] = PhotoHelper.ToSelectListItems(PhotoData.Index(), null); return(View(data)); }