public async Task InvokeAsync_Provided_Username_Password_Data_User_NULL_Expected_Result_0() { _logger.Responses.Clear(); TestConsole console = new TestConsole(); const string str = "randomstringrandomstring"; Random r = new Random(); string username = null; string password = new string(str.ToCharArray().OrderBy(s => (r.Next(3) % 2) == 0).ToArray()); _data.User = null; ConfigCommand command = new ConfigCommand(username, password, _store, _logger, _data); int result = await command.InvAsync(console); Assert.IsTrue(result == 0); }
public async Task InvokeAsync_Provided_Username_Password_Expected_Updated_DataFile() { _logger.Responses.Clear(); TestConsole console = new TestConsole(); const string str = "randomstringrandomstring"; Random r = new Random(); string username = new string(str.ToCharArray().OrderBy(s => (r.Next(2) % 2) == 0).ToArray()); string password = new string(str.ToCharArray().OrderBy(s => (r.Next(3) % 2) == 0).ToArray()); ConfigCommand command = new ConfigCommand(username, password, _store, _logger, _data); await command.InvAsync(console); AppData resultData = _store.Read(); Assert.IsTrue(resultData.User.UserName == username && resultData.User.Password == password); _data.User.UserName = "******"; _data.User.Password = "******"; _store.Write(_data); }