/* * Receive and verify input string. * * The method is public. * * Input: String user input. * Output: 1 if user input is valid, is not in database. * 0 if user input is not valid, is in database. */ public string int_InputHandler_VerifyUserInput(String string_UserInput) { /* Write into data storage */ mydatastorage.int_IoDatastorage_WriteDataToStorage(string_UserInput, Storage.s_PathTextfile); // "C:\\Users\\mfle\\Desktop\\myFile.txt"); /* Read from written data storage. */ string myTest = mydatastorage.string_IoDataStorage_ReadDataFromStorage(Storage.s_PathTextfile); return(myTest); }
public void int_IoDatastorage_WriteDataToStorage() { //arrange IoDatastorage myModel = new IoDatastorage(); IoDatastorage myIoDatastorage = new IoDatastorage(); String formalizedString = ",Hallo[17.05.2021 00:00:00]"; String string_Data = ""; int retVal = -1; //act File.WriteAllText(Storage.s_PathTextfile, ""); retVal = myModel.int_IoDatastorage_WriteDataToStorage(formalizedString, Storage.s_PathTextfile); string_Data = myIoDatastorage.string_IoDataStorage_ReadDataFromStorage(string_Data); //assert Assert.Equal(formalizedString, string_Data); Assert.Equal(0, retVal); // expect 0 for successful "transaction" }