public NutDataListToNutritionFacts ( List |
||
nutList | List |
|
Результат |
public void NutDataListToNutritionFactsTest_ShouldReseiveListOfNut_DATA_AndConvertToNutritionFactsObject() { //arrange NUT_DATA NutData1 = new NUT_DATA { NDB_No = "1", Nutr_No = "203", Nutr_Val = 101, Num_Data_Pts = 1, Std_Error = 1, Src_Cd = "Src_Cd", Deriv_Cd = "Deriv_Cd", Ref_NDB_No = "Ref_NDB_No", Add_Nutr_Mark = "Add_Nutr_Mark", Num_Studies = 1, Min = 101, Max = 201, DF = 1, Low_EB = 1, Up_EB = 1, Stat_Cmt = "Stat_Cmt", AddMod_Date = "12/2013", }; NUT_DATA NutData2 = new NUT_DATA { NDB_No = "1", Nutr_No = "205", Nutr_Val = 102, Num_Data_Pts = 2, Std_Error = 2, Src_Cd = "Src_Cd", Deriv_Cd = "Deriv_Cd", Ref_NDB_No = "Ref_NDB_No", Add_Nutr_Mark = "Add_Nutr_Mark", Num_Studies = 2, Min = 102, Max = 202, DF = 2, Low_EB = 2, Up_EB = 2, Stat_Cmt = "Stat_Cmt", AddMod_Date = "12/2013", }; NUT_DATA NutData3 = new NUT_DATA { NDB_No = "1", Nutr_No = "210", Nutr_Val = 103, Num_Data_Pts = 3, Std_Error = 3, Src_Cd = "Src_Cd", Deriv_Cd = "Deriv_Cd", Ref_NDB_No = "Ref_NDB_No", Add_Nutr_Mark = "Add_Nutr_Mark", Num_Studies = 3, Min = 103, Max = 203, DF = 3, Low_EB = 3, Up_EB = 3, Stat_Cmt = "Stat_Cmt", AddMod_Date = "12/2013", }; List<NUT_DATA> nutList = new List<NUT_DATA>() { NutData1, NutData2, NutData3 }; //act USDAImport usdaImport = new USDAImport(); NutritionFacts nutFacts = usdaImport.NutDataListToNutritionFacts(nutList); //assert Assert.IsNotNull(nutFacts); Assert.AreEqual(nutFacts.FullNutrisionList.Count, 3); Assert.AreEqual(nutFacts.Protein, 101); Assert.AreEqual(nutFacts.TotalCarbohydrate, 102); Assert.IsNotNull(nutFacts.FullNutrisionList.Exists(c => c.Nutr_No == 210)); }