public void IsValidUpc(bool expected, string input) { // Act var actual = ArticleNumberHelper.IsValidUpc(input); // Assert Assert.Equal(expected, actual); }
public void TestIsUpc() { var code = ""; // Valid tests code = "042100005264"; Assert.IsTrue(ArticleNumberHelper.IsValidUpc(code), "IsValidUpc failed for " + code); code = "614141007349"; Assert.IsTrue(ArticleNumberHelper.IsValidUpc(code), "IsValidUpc failed for " + code); code = "012993101619"; Assert.IsTrue(ArticleNumberHelper.IsValidUpc(code), "IsValidUpc failed for " + code); // Invalid tests code = "042100005260"; Assert.IsFalse(ArticleNumberHelper.IsValidUpc(code), "IsValidUpc failed for " + code); code = "00421000052644"; Assert.IsFalse(ArticleNumberHelper.IsValidUpc(code), "IsValidUpc failed for " + code); code = ""; Assert.IsFalse(ArticleNumberHelper.IsValidUpc(code), "IsValidUpc failed for " + code); code = null; Assert.IsFalse(ArticleNumberHelper.IsValidUpc(code), "IsValidUpc failed for " + code); }