public void ConnectCommand_ExecuteRequest_2() { int returnCode = 0; string configuration = "Some=Text"; Mock <IIrbisConnection> mock = GetConnectionMock(); mock.SetupGet(c => c.Connected).Returns(true); IIrbisConnection connection = mock.Object; ConnectCommand command = new ConnectCommand(connection) { Username = "******", Password = "******" }; ResponseBuilder builder = new ResponseBuilder() .AppendAnsi(CommandCode.RegisterClient).NewLine() .AppendAnsi("12345678").NewLine() .AppendAnsi("1").NewLine() .AppendAnsi("123").NewLine() .AppendAnsi("64.2014").NewLine() .NewLine() .NewLine() .NewLine() .NewLine() .NewLine() .Append(returnCode).NewLine() .AppendAnsi("30").NewLine() .AppendAnsi(configuration); TestingSocket socket = (TestingSocket)connection.Socket; socket.Response = builder.Encode(); ClientQuery query = command.CreateQuery(); command.Execute(query); }
public void ConnectCommand_CreateQuery_1() { Mock <IIrbisConnection> mock = GetConnectionMock(); IIrbisConnection connection = mock.Object; ConnectCommand command = new ConnectCommand(connection); command.CreateQuery(); }
public void CreateDictionayCommand_CreateQuery_2() { Mock <IIrbisConnection> mock = GetConnectionMock(); IIrbisConnection connection = mock.Object; ConnectCommand command = new ConnectCommand(connection) { Username = "******" }; command.CreateQuery(); }
public void ConnectCommand_CreateQuery_3() { Mock <IIrbisConnection> mock = GetConnectionMock(); IIrbisConnection connection = mock.Object; ConnectCommand command = new ConnectCommand(connection) { Username = "******", Password = "******" }; ClientQuery query = command.CreateQuery(); Assert.IsNotNull(query); }
public void ConnectCommand_ExecuteRequest_1() { int returnCode = 0; string configuration = "Some=Text"; Mock <IIrbisConnection> mock = GetConnectionMock(); IIrbisConnection connection = mock.Object; ConnectCommand command = new ConnectCommand(connection) { Username = "******", Password = "******" }; ResponseBuilder builder = new ResponseBuilder() .AppendAnsi(CommandCode.RegisterClient).NewLine() .AppendAnsi("12345678").NewLine() .AppendAnsi("1").NewLine() .AppendAnsi("123").NewLine() .AppendAnsi("64.2014").NewLine() .NewLine() .NewLine() .NewLine() .NewLine() .NewLine() .Append(returnCode).NewLine() .AppendAnsi("30").NewLine() .AppendAnsi(configuration); TestingSocket socket = (TestingSocket)connection.Socket; socket.Response = builder.Encode(); ClientQuery query = command.CreateQuery(); ServerResponse response = command.Execute(query); Assert.AreEqual(returnCode, response.ReturnCode); Assert.AreEqual(configuration, command.Configuration); Assert.AreEqual(30, command.ConfirmationInterval); Assert.AreEqual("64.2014", command.ServerVersion); }