public void HistoryOSHelper_ToSelectListItemsTests_InValid_Selected_Should_Pass() { // Arrange var data = DataSourceBackend.Instance.HistoryOSBackend.Index(); // Choose item to be selected var value = "bogus"; // Act var result = HistoryOSHelper.ToSelectListItems(data, value); var resultCount = result.Where(m => m.Selected == true).Count(); // Reset // Assert Assert.AreEqual(0, resultCount); }
public void HistoryOSHelper_ToSelectListItemsTests_Valid_Should_Pass() { // Arrange var data = DataSourceBackend.Instance.HistoryOSBackend.Index(); // Act var result = HistoryOSHelper.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).PhoneID); } }
public void HistoryOSHelper_ToSelectListItemsTests_Valid_Selected_Should_Pass() { // Arrange var data = DataSourceBackend.Instance.HistoryOSBackend.Index(); // Choose item to be selected var value = data[0].ID; // Act var result = HistoryOSHelper.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()); }