public void ReadInvalidStream() { var r = new BspReader(new MemoryStream()); r.ReadInfo(); r.Dispose(); }
public void ReadLumpDataDisposed() { var reader = new BspReader(MAP_FILENAME); reader.Dispose(); reader.ReadLumpData(0); }
public void ReadEmptyFile() { var r = new BspReader(EMPTY_FILE_FILENAME); r.ReadInfo(); r.Dispose(); }
public void WriteAndValidateOtherData() { var lumpToEdit = 39; byte[] oldData; using (var reader = new BspReader(TEMP_FILENAME)) { oldData = reader.ReadLumpData(40); } using (var writer = new BspLumpDataWriter(TEMP_FILENAME, OUTPUT_FILENAME)) { writer.WriteLumpData(lumpToEdit, exampleData); } using (var reader = new BspReader(OUTPUT_FILENAME)) { var newData = reader.ReadLumpData(40); for (int i = 0; i < newData.Length; i++) { byte oldByte = oldData[i]; byte newByte = newData[i]; Assert.AreEqual(oldByte, newByte); } } }
public void ReadInfoDisposed() { var reader = new BspReader(MAP_FILENAME); reader.Dispose(); reader.ReadInfo(); }
public void ReadInvalidHeader() { var r = new BspReader(NOT_BSP_FILE_FILENAME); r.ReadInfo(); r.Dispose(); }
public void OneNullComparison() { var r = new BspReader(MAP_FILENAME); var info1 = r.ReadInfo(); r.Dispose(); Assert.AreNotEqual(info1, null); }
public void ReadLumpDataById() { var r = new BspReader(MAP_FILENAME); var data = r.ReadLumpData(40); r.Dispose(); Assert.IsInstanceOfType(data, typeof(byte[])); Assert.IsNotNull(data); }
public void ReadLumpInfoById() { var r = new BspReader(MAP_FILENAME); var lump = r.ReadLumpInfo(40); r.Dispose(); Assert.IsInstanceOfType(lump, typeof(BspLumpInfo)); Assert.IsNotNull(lump); }
public void ReadInfo() { var r = new BspReader(MAP_FILENAME); var info = r.ReadInfo(); r.Dispose(); Assert.IsInstanceOfType(info, typeof(BspInfo)); Assert.IsNotNull(info); }
public void CtorReadFromBinaryReader() { using (var stream = new FileStream(MAP_FILENAME, FileMode.Open)) { using (var reader = new BinaryReader(stream)) { var r = new BspReader(reader); } } }
public void WriteAndValidateLumpInfo() { WriteLumpInfo(); var reader = new BspReader(TEMP_FILENAME); var tempLumpInfo = reader.ReadLumpInfo(0); reader.Dispose(); Assert.AreEqual(tempLumpInfo, exampleLump); }
public void ComparisonTest() { var r = new BspReader(MAP_FILENAME); var info1 = r.ReadInfo(); r.Dispose(); r = new BspReader(MAP_FILENAME); var info2 = r.ReadInfo(); r.Dispose(); Assert.AreEqual(info1, info2); }
public void WriteData() { var lumpToEdit = 39; using (var writer = new BspLumpDataWriter(TEMP_FILENAME, OUTPUT_FILENAME)) { writer.WriteLumpData(lumpToEdit, exampleData); } using (var reader = new BspReader(OUTPUT_FILENAME)) { Assert.AreEqual(exampleData.Length, reader.ReadLumpData(lumpToEdit).Length); } }
public void ReadInCustomOrder() { var reader = new BspReader(MAP_FILENAME); var reference = reader.ReadInfo(); reader.Dispose(); reader = new BspReader(MAP_FILENAME); var meaninglessVar = reader.ReadLumpInfo(BspLumpType.LUMP_PAKFILE); var tested = reader.ReadInfo(); reader.Dispose(); Assert.AreEqual(reference, tested); }
public void ReadLumpDataDisposedMessage() { var reader = new BspReader(MAP_FILENAME); reader.Dispose(); try { reader.ReadLumpData(0); Assert.Fail(); } catch (Exception ex) { Assert.AreEqual(ex.Message, exceptionMessage); } }
public void CtorReadFile() { var r = new BspReader(MAP_FILENAME); r.Dispose(); }
public void CtorReadFromStream() { var r = new BspReader((Stream)(new FileStream(MAP_FILENAME, FileMode.Open))); r.Dispose(); }