public void ConvertCtoT2() { var convert = new GeneralFunctionality(); var actual = 8; Assert.AreEqual(convert.CupsToTablespoons(.5m), actual); }
public void TestForCups() { var convert = new GeneralFunctionality(); var actual = 32; Assert.AreEqual(convert.CupsToTablespoons(2), actual); }
public void ConverttToT() { var convert = new GeneralFunctionality(); var actual = 1; Assert.AreEqual(convert.TeaspoonsToTablespoons(3), actual); }
public void Percent2() { var percent = new GeneralFunctionality(); var actual = percent.percent(80, 50); Assert.AreEqual(160, actual); }
public void Percent() { var percent = new GeneralFunctionality(); var actual = percent.percent(20, 100); Assert.AreEqual(20, actual); }
public void ConvertCToT() { var convert = new GeneralFunctionality(); var actual = 16; Assert.AreEqual(convert.CupsToTablespoons(1), actual); }
public void TestImproperFraction() { var fraction = new GeneralFunctionality(); var expected = 2.5m; var actual = fraction.CalculateDecimalFromFraction("2 1/2"); Assert.AreEqual(expected, actual); }
public void LbsToOunces() { var convert = new GeneralFunctionality(); var actual = convert.PoundsToOunces(5.5m); var expected = 88m; Assert.AreEqual(expected, actual); }
public void TestSimpleDivision() { var divide = new GeneralFunctionality(); var expected = .125m; var actual = divide.SimpleDivision(1, 8); Assert.AreEqual(expected, actual); }
public void CalculateDecimalOfOneEighth() { var fractionToDecimal = new GeneralFunctionality(); var expected = .125m; var actual = fractionToDecimal.CalculateDecimalFromFraction("1/8"); Assert.AreEqual(expected, actual); }
public void IsStringAValidNumber() { var test = new GeneralFunctionality(); var expected = true; var actual = test.IsStringNumericValue("11.98"); Assert.AreEqual(expected, actual); }
public void TestSTringIfNumeric3() { var testString = new GeneralFunctionality(); var expected = false; var actual = testString.IsStringNumericValue("flour"); Assert.AreEqual(expected, actual); }
public void TestingIfStringIsNumeric() { var testString = new GeneralFunctionality(); var expected = true; var actual = testString.IsStringNumericValue("1345642"); Assert.AreEqual(expected, actual); }
public void TestNonNumericFraction() { var fraction = new GeneralFunctionality(); var expected = 0m; var actual = fraction.CalculateDecimalFromFraction("2 b/r"); Assert.AreEqual(expected, actual); }
public void TestDivisionFractions2() { var divide = new GeneralFunctionality(); var expected = .278m; var actual = divide.CalculateDecimalFromFraction("5/18"); Assert.AreEqual(expected, actual); }
public void OuncesToLbs() { var convert = new GeneralFunctionality(); var actual = convert.OuncesToPounds(23); var expected = 1.4375m; Assert.AreEqual(expected, actual); }
public decimal GetAmountOfOuncesUsed(string Ingredient, string measuredCups, string filename) { var vw = new VolumeToWeightLogic(); var divide = new GeneralFunctionality(); var GetOuncesForIngredient = vw.ReadOuncesForIngredient(Ingredient, filename); var GetPercentMeasuredCupsToStandardCups = vw.PercentageOfMeasuredCupsToStandardCups(measuredCups); return(GetPercentMeasuredCupsToStandardCups * GetOuncesForIngredient); }
public decimal PercentageOfMeasuredCupsToStandardCups(string measuredCups) { var divide = new GeneralFunctionality(); if (measuredCups.Contains('/')) { return(divide.CalculateDecimalFromFraction(measuredCups)); } else { return((Convert.ToDecimal(measuredCups)) / 1); } }
/* * get price per ounce for gallons * get price per ounce for ounces * get price per ounce for lbs */ // public decimal PricePerGallon(string Ingredient, string UnitOfMeasurement, string VolumeToWeightRatioDatabaseFilename, string ResponseDatabaseFilename) //{ // var read = new Reader(); // var RatioDatabse = read.ReadDatabase(VolumeToWeightRatioDatabaseFilename); // var ResponseDatabase = read.ReadDatabase(ResponseDatabaseFilename); // for (int i = 0; i < ResponseDatabase.Count(); i++) // { // if (ResponseDatabase[i].Contains(Ingredient) && ResponseDatabase[i].Contains(UnitOfMeasurement)) // { // for (int j = 0; j < RatioDatabse.Count(); j++) // { // if (RatioDatabse[j].Contains(Ingredient} // } // { // })) // } // } // } public decimal GetPriceForOneOunceOfIngredient(string Ingredient, string VolumeToWeightRatioDatabase, string ResponseDatabaseFilename) { var read = new Reader(); var split = new SplitLines(); var GetOunces = new VolumeToWeightLogic(); var convertToNmber = new GeneralFunctionality(); var IngredientVolumeToWeightRatios = read.ReadDatabase(VolumeToWeightRatioDatabase); var UnalteredResponseDatabase = read.ReadDatabase(ResponseDatabaseFilename); var IngredientPrice = 0m; //var ParsedNumberString = 0m;IngredientName, IngredientPrice var CalculatedOunces = 0m; //var OuncesForStandardMeasuredIngredient = 0m; var PricePerOunce = 0m; for (int i = 0; i < UnalteredResponseDatabase.Count(); i++) { if (UnalteredResponseDatabase[i].Contains(Ingredient)) { IngredientPrice = GetPriceForIndividualIngredient(Ingredient); //, ResponseDatabaseFilename); for (int j = 0; j < IngredientVolumeToWeightRatios.Count(); j++) { if (IngredientVolumeToWeightRatios[j].Contains(Ingredient)) { if (UnalteredResponseDatabase[i].ToLower().Contains(("oz"))) { var FindNumbers = split.SplitLineAtSpace(UnalteredResponseDatabase[i]); foreach (var array in FindNumbers) { decimal output; if (convertToNmber.IsStringNumericValue(array) == true) { Decimal.TryParse(array, out output);//memory representaion, keeping a file in memory to get the values... it's a memory manager ... it's a data structure manager that manages the memory of that files CalculatedOunces = output; } } } //.Cgallons, lbs || pounds, oz, //) //OuncesForStandardMeasuredIngredient = GetOunces.ReadOuncesForIngredient(Ingredient, VolumeToWeightRatioDatabase); }//how many cups are in the bag of whatever is sold, then do the math with the ounces } } } PricePerOunce = IngredientPrice / CalculatedOunces; return(PricePerOunce); }
public string ConvertTeaspoonsToTablespoons(string MeasurementInTeaspoons) { var Round = new RoundDecimalPlaces(); var ToTablespoons = new GeneralFunctionality(); var split = new SplitLines(); var TeaspoonsToTablespoons = 0m; var RoundedTablespoonMeasurement = ""; var IngredientLine = split.SplitLineAtSpace(MeasurementInTeaspoons); TeaspoonsToTablespoons = ToTablespoons.TeaspoonsToTablespoons(Convert.ToDecimal(IngredientLine[0])); if (TeaspoonsToTablespoons == 1m) { RoundedTablespoonMeasurement = Round.RoundToHundrethDecimalPlace(TeaspoonsToTablespoons) + " tablespoon"; } else { RoundedTablespoonMeasurement = Round.RoundToHundrethDecimalPlace(TeaspoonsToTablespoons) + " tablespoons"; } return(RoundedTablespoonMeasurement); }
public string ConvertCupsToTablespoons(string MeasurementInCups) { var Round = new RoundDecimalPlaces(); var ToTablespoons = new GeneralFunctionality(); var Split = new SplitLines(); string RoundedTablespoonMeasurement = ""; string[] IngredientLine = Split.SplitLineAtSpace(MeasurementInCups); //there's something about CupsToTablespoonMeasurement - this is where I am getting the error in the stack trace in all of my failing tests that use this method decimal CupsToTablespoonMeasurement = ToTablespoons.CupsToTablespoons(Convert.ToDecimal(IngredientLine[0])); if (CupsToTablespoonMeasurement == 1m) { RoundedTablespoonMeasurement = CupsToTablespoonMeasurement + " tablespoon"; } else { RoundedTablespoonMeasurement = Round.RoundToHundrethDecimalPlace(CupsToTablespoonMeasurement) + " tablespoons"; } return(RoundedTablespoonMeasurement); }
public void WhatABunchOfSquares() { var sqaure = new GeneralFunctionality(); Assert.AreEqual(16, sqaure.sqaure(4)); }
int IGetVolume.GetVolume() { var square = new GeneralFunctionality(); return((int)(Math.PI * (square.sqaure(_diameter / 2)) * _depth)); }