public void DatabaseInfo_Describe_1() { DatabaseInfo database = _GetDatabase(); string expected = "Name: IBIS\nDescription: Электронный каталог\nMax MFN: 0\nRead-only: False\nDatabase locked: False\n"; string actual = database.Describe().DosToUnix(); Assert.AreEqual(expected, actual); }
public void DatabaseInfo_Describe_2() { DatabaseInfo database = _GetDatabase(); database.LogicallyDeletedRecords = new[] { 1, 2, 3 }; database.PhysicallyDeletedRecords = new[] { 4, 5, 6 }; database.LockedRecords = new[] { 7, 8, 9 }; database.NonActualizedRecords = new[] { 10, 11, 12 }; database.MaxMfn = 1000; string expected = "Name: IBIS\nDescription: Электронный каталог\nLogically deleted records: 1-3\nPhysically deleted records: 4-6\nNon-actualized records: 10-12\nLocked records: 7-9\nMax MFN: 1000\nRead-only: False\nDatabase locked: False\n"; string actual = database.Describe().DosToUnix(); Assert.AreEqual(expected, actual); }
public void DatabaseInfo_ParseServerResponse_2() { ResponseBuilder builder = new ResponseBuilder(); // Physically deleted records builder.NewLine() // Logically deleted records .NewLine() // Non-actualized records .AppendUtf("7\x001E8\x001E9").NewLine() // Locked records .AppendUtf("10\x001E11\x001E12").NewLine() // Maximal MFN .AppendUtf("1000").NewLine() // Database locked? .AppendUtf("0").NewLine(); IrbisConnection connection = new IrbisConnection(); byte[] query = new byte[0]; byte[] answer = builder.Encode(); ServerResponse response = new ServerResponse ( connection, answer, query, true ); DatabaseInfo database = DatabaseInfo.ParseServerResponse(response); Assert.AreEqual ( "Name: (null)\nDescription: (null)\nLogically deleted records: \nPhysically deleted records: \nNon-actualized records: 7-9\nLocked records: 10-12\nMax MFN: 1000\nRead-only: False\nDatabase locked: False\n", database.Describe().DosToUnix() ); }