public void IrbisVersion_ParseServerResponse_2() { // В три строки ResponseBuilder builder = new ResponseBuilder(); builder .AppendAnsi("64.2015.1").NewLine() .AppendAnsi("10").NewLine() .AppendAnsi("100000").NewLine(); IrbisConnection connection = new IrbisConnection(); byte[] query = new byte[0]; byte[] answer = builder.Encode(); ServerResponse response = new ServerResponse ( connection, answer, query, true ); IrbisVersion version = IrbisVersion.ParseServerResponse(response); Assert.IsNull(version.Organization); Assert.AreEqual("64.2015.1", version.Version); Assert.AreEqual(10, version.ConnectedClients); Assert.AreEqual(100000, version.MaxClients); }
public void IrbisVersion_ParseServerResponse_1() { // В четыре строки ResponseBuilder builder = new ResponseBuilder(); builder .AppendAnsi("Иркутский государственный технический университет").NewLine() .AppendAnsi("64.2015.1").NewLine() .AppendAnsi("10").NewLine() .AppendAnsi("100000").NewLine(); IrbisConnection connection = new IrbisConnection(); byte[] query = new byte[0]; byte[] answer = builder.Encode(); ServerResponse response = new ServerResponse ( connection, answer, query, true ); IrbisVersion version = IrbisVersion.ParseServerResponse(response); Assert.AreEqual("Иркутский государственный технический университет", version.Organization); Assert.AreEqual("64.2015.1", version.Version); Assert.AreEqual(10, version.ConnectedClients); Assert.AreEqual(100000, version.MaxClients); }
public void IrbisVersion_Construction_1() { IrbisVersion version = new IrbisVersion(); Assert.IsNull(version.Organization); Assert.IsNull(version.Version); Assert.AreEqual(0, version.ConnectedClients); Assert.AreEqual(0, version.MaxClients); }
public void IrbisVersion_ToXml_1() { IrbisVersion version = new IrbisVersion(); Assert.AreEqual("<version />", XmlUtility.SerializeShort(version)); version = _GetVersion(); Assert.AreEqual("<version organization=\"Иркутский государственный технический университет\" version=\"64.2015.1\" max-clients=\"100000\" connected-clients=\"10\" />", XmlUtility.SerializeShort(version)); }
public void IrbisVersion_ToString_1() { IrbisVersion version = new IrbisVersion(); Assert.AreEqual("Version: (null), MaxClients: 0, ConnectedClients: 0, Organization: (null)", version.ToString()); version = _GetVersion(); Assert.AreEqual("Version: 64.2015.1, MaxClients: 100000, ConnectedClients: 10, Organization: Иркутский государственный технический университет", version.ToString()); }
public void IrbisVersion_ToJson_1() { IrbisVersion version = new IrbisVersion(); Assert.AreEqual("{}", JsonUtility.SerializeShort(version)); version = _GetVersion(); Assert.AreEqual("{'organization':'Иркутский государственный технический университет','version':'64.2015.1','max-clients':100000,'connected-clients':10}", JsonUtility.SerializeShort(version)); }
public void IrbisVersion_Serialization_1() { IrbisVersion version = new IrbisVersion(); _TestSerialization(version); version = _GetVersion(); _TestSerialization(version); }
private IrbisVersion _GetVersion() { IrbisVersion result = new IrbisVersion { Organization = "Иркутский государственный технический университет", Version = "64.2015.1", MaxClients = 100000, ConnectedClients = 10 }; return(result); }
/// <inheritdoc /> public override ServerResponse Execute ( ClientQuery query ) { ServerResponse response = base.Execute(query); response.GetReturnCode(); Result = IrbisVersion.ParseServerResponse(response); return(response); }
private void _TestSerialization ( [NotNull] IrbisVersion first ) { byte[] bytes = first.SaveToMemory(); IrbisVersion second = bytes.RestoreObjectFromMemory <IrbisVersion>(); Assert.AreEqual(first.Organization, second.Organization); Assert.AreEqual(first.Version, second.Version); Assert.AreEqual(first.MaxClients, second.MaxClients); Assert.AreEqual(first.ConnectedClients, second.ConnectedClients); }
static void Main() { try { using (IrbisConnection connection = new IrbisConnection()) { connection.ParseConnectionString("host=127.0.0.1;port=6666;user=1;password=1;db=IBIS;"); connection.Connect(); IrbisVersion version = connection.GetServerVersion(); MessageBox.Show(version.ToString(), "SharpIrbis"); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "SharpIrbis"); } }
static void Main() { try { using (IrbisConnection connection = new IrbisConnection()) { connection.ParseConnectionString("host=127.0.0.1;port=6666;user=1;password=1;db=IBIS;"); connection.Connect(); IrbisVersion version = connection.GetServerVersion(); Console.WriteLine(version); } } catch (Exception ex) { Console.WriteLine(ex); } }
public void IrbisVersion_ParseServerResponse_4() { // В три строки List <string> response = new List <string> { "64.2015.1", "10", "100000" }; IrbisVersion version = IrbisVersion.ParseServerResponse(response); Assert.IsNull(version.Organization); Assert.AreEqual("64.2015.1", version.Version); Assert.AreEqual(10, version.ConnectedClients); Assert.AreEqual(100000, version.MaxClients); }
public void IrbisVersion_ParseServerResponse_3() { // В четыре строки List <string> response = new List <string> { "Иркутский государственный технический университет", "64.2015.1", "10", "100000" }; IrbisVersion version = IrbisVersion.ParseServerResponse(response); Assert.AreEqual("Иркутский государственный технический университет", version.Organization); Assert.AreEqual("64.2015.1", version.Version); Assert.AreEqual(10, version.ConnectedClients); Assert.AreEqual(100000, version.MaxClients); }
public void ServerVersion_Test1() { IrbisVersion version = Connection.GetServerVersion(); Write(version); }