public void TestSimilarities8() { var rest = new MakeRESTCalls(); var expected = true; var actual = rest.SimilaritesInStrings("Softasilk Cake Flour", "cake flour"); Assert.AreEqual(expected, actual); }
public void TestSimilarities7() { var rest = new MakeRESTCalls(); var expected = false; var actual = rest.SimilaritesInStrings("Granulated Sugar", "grnaulated sugar"); Assert.AreEqual(expected, actual); }
public void TestSimilarities5() { var rest = new MakeRESTCalls(); var expected = true; var actual = rest.SimilaritesInStrings("All Purpose Flour", "all purpose flour"); Assert.AreEqual(expected, actual); }
public void TestSimilarities4() { var rest = new MakeRESTCalls(); var expected = false; var actual = rest.SimilaritesInStrings("chocolate morsels", "chocolate chips"); Assert.AreEqual(expected, actual); }
public void TestSimilarities2() { var rest = new MakeRESTCalls(); var expected = true; var actual = rest.SimilaritesInStrings("confectioner's sugar", "confectioner's sugar"); Assert.AreEqual(expected, actual); }
public void TestSimiliarities6() { var rest = new MakeRESTCalls(); //var expected = true; var expected = false; var actual = rest.SimilaritesInStrings("All-Purpose FLour", "all purpose flour"); Assert.AreEqual(expected, actual); //this isn't passing becasue of the - in All-Purpose... that's something that may need to be fixed later on... //or just have a comment in the }
public void insertIngredientIntoDensityInfoDatabase(Ingredient i) { var rest = new MakeRESTCalls(); var db = new DatabaseAccess(); insertDensityTextFileIntoDensityInfoDatabase(); var myUpdatedDensityInfoTable = queryDensityInfoTable(); var myMilkAndEggDensityInfoIngredients = new List <Ingredient>(); foreach (var ingredient in myUpdatedDensityInfoTable) { if (ingredient.name.ToLower().Contains("milk") || ingredient.name.ToLower().Contains("egg")) { myMilkAndEggDensityInfoIngredients.Add(ingredient); } } var countSimilarIngredients = 0; foreach (var ingredient in myUpdatedDensityInfoTable) { if (i.typeOfIngredient.ToLower().Contains("milk") || i.typeOfIngredient.ToLower().Contains("egg")) { foreach (var dairyOrEggIngredient in myMilkAndEggDensityInfoIngredients) { if (i.typeOfIngredient == dairyOrEggIngredient.name) { countSimilarIngredients++; break; } } break; } else { if (rest.SimilaritesInStrings(i.typeOfIngredient, ingredient.name)) { countSimilarIngredients++; break; } } } if (countSimilarIngredients == 0) { var commandText = @"Insert into densityInfo (ingredient, density) values (@ingredient, @density);"; db.executeVoidQuery(commandText, cmd => { cmd.Parameters.AddWithValue("@ingredient", i.typeOfIngredient); cmd.Parameters.AddWithValue("@density", i.density); return(cmd); }); } //all this is doing is determining if the density table already has an ingredient with said name, if so, then it won't add it, if the table doesn't have that name, it will insert it with the density var myDensityInfoDatabase = queryDensityInfoTable(); }