public void BatteryInfo_UWP_GetBatteryInfo_NoneInput_9initializedFieldsReturned() { // Arrange BatteryInfo_UWP_API biUWP = new BatteryInfo_UWP_API(); Dictionary <string, string> expectedFields = new Dictionary <string, string> // expected translation { { "Темп зарядки/розрядки, мВт", "" }, { "Заводская макс. емкость, мВтЧ", "" }, { "Текущая макс. емкость, мВтЧ", "" }, { "Оставшаяся емкость, мВтЧ", "" }, { "Статус батареи", "" }, { "Режим сбережения энергии", "" }, { "Статут источника питания", "" }, { "Осташаяся емкость, %", "" }, { "Оставшееся время работы", "" } }; Dictionary <string, string> receivedFields; // Act receivedFields = biUWP.GetBatteryInfo(); // Assert foreach (KeyValuePair <string, string> pair in receivedFields) { // is field is not null and with right translation, than true Assert.IsTrue((expectedFields.ContainsKey(pair.Key)) && (pair.Value != null)); } Assert.IsTrue(receivedFields.Count == expectedFields.Count); // check for equal count of fields }
public void PDFReportCreator_CreateReport__PathToFileInput__NewPdfFile() { // Arrange bool expectedFile_Existing_Method_Result = true; string pathToFile = @"TestCreating.pdf"; PdfReportCreator reportCreator = new BatteryChecker.Model.Reports.PdfReportCreator(); List <BatteryProperty> testBatteryInfoRequiredFormat = new List <BatteryProperty>(); BatteryInfo_UWP_API testBatteryInfo = new BatteryInfo_UWP_API(); Dictionary <string, string> testBatteryInfoSourceFormat = testBatteryInfo.GetBatteryInfo(); foreach (KeyValuePair <string, string> bp in testBatteryInfoSourceFormat) { testBatteryInfoRequiredFormat.Add(new BatteryProperty(bp.Key, bp.Value)); } // Act reportCreator.CreateReport(pathToFile, testBatteryInfoRequiredFormat); // Assert Assert.AreEqual(expectedFile_Existing_Method_Result, File.Exists(pathToFile)); }