protected void SendAndCheck(PacketPb packet, string?filename = null, bool isFirst = false) { if (filename != null) { using var file = File.Open(filename, isFirst ? FileMode.Create : FileMode.Append); packet.WriteDelimitedTo(file); } var response = MapClient.Handle(packet); Assert.True(response.ErrType == ErrorStatusPb.Types.ErrorStatusEnum.Succeeded, response.Message); }
public void Create() { var packet = new PacketPb { Action = PacketPb.Types.ActionType.Add, Points = new PacketPb.Types.Points(), Special = true, }; packet.Points.Data.Add(_map); using var file = File.Open(Filename, FileMode.Create); packet.WriteDelimitedTo(file); }
public void SendInfoPackage() { var packet = new PacketPb { Action = PacketPb.Types.ActionType.Info, Points = new PacketPb.Types.Points(), Message = "This is package with info message", Special = true, }; packet.Points.Data.Add(_map); using var file = File.Open(Filename, FileMode.Append); packet.WriteDelimitedTo(file); }
public void Add() { var packet = new PacketPb { Action = PacketPb.Types.ActionType.Add, Points = new PacketPb.Types.Points(), Special = true, }; _map = _map.Select(p => { p.Id = _map.Length + p.Id; return(p); }).ToArray(); packet.Points.Data.Add(_map); using var file = File.Open(Filename, FileMode.Append); packet.WriteDelimitedTo(file); }