public void VersionAppHelper_ConvertIDtoString_InValid_Bogus_Should_Fail() { // Arrange // Act var result = VersionAppHelper.ConvertIDtoString("bogus"); // Reset // Assert Assert.AreEqual(string.Empty, result); }
public void VersionAppHelper_ToSelectListItemsTests_Valid_Should_Pass() { // Arrange var data = DataSourceBackend.Instance.VersionAppBackend.Index(); // Act var result = VersionAppHelper.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).VersionAppName); } }
public void VersionAppHelper_ToSelectListItemsTests_InValid_Selected_Should_Pass() { // Arrange var data = DataSourceBackend.Instance.VersionAppBackend.Index(); // Choose item to be selected var value = "bogus"; // Act var result = VersionAppHelper.ToSelectListItems(data, value); var resultCount = result.Where(m => m.Selected == true).Count(); // Reset // Assert Assert.AreEqual(0, resultCount); }
public void VersionAppHelper_ConvertIDtoString_Valid_Should_Pass() { // Arrange var data = new VersionAppModel { VersionAppName = "Name" }; DataSourceBackend.Instance.VersionAppBackend.Create(data); // Act var result = VersionAppHelper.ConvertIDtoString(data.ID); // Reset DataSourceBackend.Instance.Reset(); // Assert Assert.AreEqual("Name", result); }
public void VersionAppHelper_ToSelectListItemsTests_Valid_Selected_Should_Pass() { // Arrange var data = DataSourceBackend.Instance.VersionAppBackend.Index(); // Choose item to be selected var value = data[0].ID; // Act var result = VersionAppHelper.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()); }