public async Task Struct() { //Arrange int expectedItemsCount = 1; var expected = new MovieStruct { Title = "ET", Id = 2 }; //Act var source = MoviesStream.Select(c => new { Str = new MovieStruct { Title = "ET", Id = 2 }, c.Release_Year }).ToAsyncEnumerable(); var actualValues = await CollectActualValues(source, expectedItemsCount); //Assert var actualStr = actualValues.First().Str; actualStr.Title.Should().Be(expected.Title); actualStr.Id.Should().Be(expected.Id); actualValues.First().Release_Year.Should().Be(MoviesProvider.Movie1.Release_Year); }
public static (MovieStruct, MovieStatus) ParseMovie(string Path) { FileStream fs = null; try { fs = new FileStream(Path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite); } catch { System.Windows.Forms.MessageBox.Show("File inaccessible", "M64 Parsing Subroutine"); if (fs != null) { fs.Close(); } return(new MovieStruct(), MovieStatus.Fail_AccessSteal); } BinaryReader br = new BinaryReader(fs); MovieStruct movieData = new MovieStruct(); movieData.magic = br.ReadUInt32(); movieData.version = br.ReadUInt32(); movieData.uid = br.ReadUInt32(); movieData.length_vis = br.ReadUInt32(); movieData.rerecord_count = br.ReadUInt32(); movieData.vis_per_second = br.ReadByte(); movieData.num_controllers = br.ReadByte(); br.ReadBytes(2); movieData.length_samples = br.ReadUInt32(); movieData.startFlags = br.ReadUInt16(); br.ReadBytes(2); movieData.controllerFlags = br.ReadUInt32(); br.ReadBytes(160); movieData.romNom = Encoding.ASCII.GetString(br.ReadBytes(32)); movieData.romCRC = br.ReadUInt32(); movieData.romCountry = br.ReadUInt16(); br.ReadBytes(56); movieData.videoPluginName = Encoding.ASCII.GetString(br.ReadBytes(64)); movieData.soundPluginName = Encoding.ASCII.GetString(br.ReadBytes(64)); movieData.inputPluginName = Encoding.ASCII.GetString(br.ReadBytes(64)); movieData.rspPluginName = Encoding.ASCII.GetString(br.ReadBytes(64)); movieData.authorInfos = Encoding.ASCII.GetString(br.ReadBytes(222)); movieData.description = Encoding.ASCII.GetString(br.ReadBytes(256)); fs.Close(); br.Close(); return(movieData, MovieStatus.Ok); }