public void IsValidWhenTheMinimumNecessaryInformationAreThere() { var hdasset = new HdAsset(); using var stream = new MemoryStream(); hdasset.Write(stream); Assert.True(HdAsset.IsValid(stream.SetPosition(0))); }
public void IsNotValidWhenTheInnerStreamLengthIsTooBig() { var hdasset = new HdAsset(); hdasset.Stream = new MemoryStream(new byte[] { 2, 3, 4, 5, 6, 7, 8 }); using var stream = new MemoryStream(); hdasset.Write(stream); stream.SetLength(stream.Length - 1); Assert.False(HdAsset.IsValid(stream.SetPosition(0))); }
public void IsNotValidIfThereAreTooManyHdAssets() { var hdasset = new HdAsset(); hdasset.Stream = new MemoryStream(new byte[] { 2, 3, 4, 5, 6, 7, 8 }); hdasset.Entries = Enumerable .Range(0, 1024) .Select(x => new HdAsset.Entry() { Name = "Test", Stream = new MemoryStream() }) .ToList(); using var stream = new MemoryStream(); hdasset.Write(stream); stream.SetLength(stream.Length - 1); Assert.False(HdAsset.IsValid(stream.SetPosition(0))); }
public void IsNotValidWhenTheHeaderSizeIsTooSmall() { var stream = new MemoryStream(new byte[15]); Assert.False(HdAsset.IsValid(stream)); }
public void IsValid() => Helpers.UseAsset("ps4archive.bin", stream => { Assert.True(HdAsset.IsValid(stream)); });