public void WrongRunCommandTypesCases() { _mock.Answers.Add("OK"); _mock.Answers.Add("AT+MODE?"); _mock.Answers.Add(""); _mock.Answers.Add("+MODE: \"GPRS\", \"AWAIT\""); _mock.Answers.Add("OK"); _mock.Answers.Add(""); _mock.Answers.Add("OK"); List<BaseATCommand> zList = new List<BaseATCommand>(); AppModeCommand zAppCommand = new AppModeCommand(); zList.Add(zAppCommand); RestartCommand zRestartCommand = new RestartCommand(); zList.Add(zRestartCommand); Dictionary<BaseATCommand, bool> zResult; string zErrorMessage = ""; zResult = base.RunCommands(zList, CommandType.ctRead, out zErrorMessage); Assert.Equal(2, zResult.Count); Assert.Equal("", zErrorMessage); Assert.True(zResult[zAppCommand]); Assert.False(zResult[zRestartCommand]); }
public void CorrectWritableCommandRun() { _mock.Answers.Add("OK"); AppModeCommand zCommand = new AppModeCommand(); zCommand.DeviceConnectionMode = ConnectionMode.CSD; zCommand.DeviceConnectionType = ConnectionType.ACTIVE; Assert.True(base.RunSingleWritableCommand(zCommand)); Assert.Equal("AT+MODE=\"CSD\",\"ACTIVE\"", _mock.Commands.First()); }
public void CorrectRunCommandCases() { _mock.Answers.Add("OK"); _mock.Answers.Add("AT+MODE?"); _mock.Answers.Add(""); _mock.Answers.Add("+MODE: \"GPRS\", \"AWAIT\""); _mock.Answers.Add("OK"); _mock.Answers.Add("AT+MODE?"); _mock.Answers.Add(""); _mock.Answers.Add("+MODE: \"GPRS\", \"AWAIT\""); _mock.Answers.Add("OK"); List<BaseATCommand> zList = new List<BaseATCommand>(); AppModeCommand zAppCommand = new AppModeCommand(); zList.Add(zAppCommand); AppModeCommand zAppCommand2 = new AppModeCommand(); zList.Add(zAppCommand2); Dictionary<BaseATCommand, bool> zResult; string zErrorMessage = ""; zResult = base.RunCommands(zList, CommandType.ctRead, out zErrorMessage); Assert.Equal(2, zResult.Count); Assert.Equal("", zErrorMessage); Assert.True(zResult[zAppCommand]); Assert.True(zResult[zAppCommand2]); _mock.Answers.Add("OK"); _mock.Answers.Add("OK"); _mock.Answers.Add("OK"); zList.Clear(); AppModeCommand zCommand; zCommand = new AppModeCommand(); zCommand.DeviceConnectionMode = ConnectionMode.CSD; zCommand.DeviceConnectionType = ConnectionType.ACTIVE; zList.Add(zCommand); AppModeCommand zCommand2; zCommand2 = new AppModeCommand(); zCommand2.DeviceConnectionMode = ConnectionMode.CSD; zCommand2.DeviceConnectionType = ConnectionType.ACTIVE; zList.Add(zCommand2); zResult = base.RunCommands(zList, CommandType.ctWrite, out zErrorMessage); Assert.Equal(2, zResult.Count); Assert.Equal("", zErrorMessage); Assert.True(zResult[zCommand]); Assert.True(zResult[zCommand2]); zList.Clear(); _mock.Answers.Add("OK"); _mock.Answers.Add("OK"); _mock.Answers.Add("OK"); RestartCommand zRestCommand = new RestartCommand(); zList.Add(zRestCommand); RestartCommand zRestCommand2 = new RestartCommand(); zList.Add(zRestCommand2); zResult = base.RunCommands(zList, CommandType.ctRun, out zErrorMessage); Assert.Equal(2, zResult.Count); Assert.Equal("", zErrorMessage); Assert.True(zResult[zRestCommand]); Assert.True(zResult[zRestCommand2]); }
public AppModeCommandTest() { _AppModeCommand = new AppModeCommand(); _Command = _AppModeCommand; }