public void CreateDatabaseCommand_CreateQuery_1() { Mock <IIrbisConnection> mock = GetConnectionMock(); IIrbisConnection connection = mock.Object; CreateDatabaseCommand command = new CreateDatabaseCommand(connection); ClientQuery query = command.CreateQuery(); Assert.IsNotNull(query); }
public void CreateDatabaseCommand_ExecuteRequest_1() { int returnCode = 0; Mock <IIrbisConnection> mock = GetConnectionMock(); IIrbisConnection connection = mock.Object; CreateDatabaseCommand command = new CreateDatabaseCommand(connection) { Database = "NEWIBIS", Description = "New catalog" }; ResponseBuilder builder = new ResponseBuilder() .StandardHeader(CommandCode.CreateDatabase, 123, 456) .NewLine() .Append(returnCode) .NewLine(); TestingSocket socket = (TestingSocket)connection.Socket; socket.Response = builder.Encode(); ClientQuery query = command.CreateQuery(); ServerResponse response = command.Execute(query); Assert.AreEqual(returnCode, response.ReturnCode); }