public void LuigiFileMetadataProgramInformation_CreateWithMetadatda_DataOriginIsCorrect()
        {
            var path = LuigiFileMetadataProgramInformationTestStorageAccess.Initialize(TestRomResources.TestLuigiWithMetadataPath).Single();
            var rom  = Rom.AsSpecificRomType <LuigiFormatRom>(Rom.Create(path, null));

            Assert.NotNull(rom);
            var metadataBlock = rom.LocateDataBlock <LuigiMetadataBlock>();

            Assert.NotNull(metadataBlock);

            var information = new LuigiFileMetadataProgramInformation(rom.Header, metadataBlock);

            VerifyMetadataInformation(information);
        }
        public void LuigiFileMetadataProgramInformation_AddCrc_ThrowsInvalidOperationException()
        {
            var path = LuigiFileMetadataProgramInformationTestStorageAccess.Initialize(TestRomResources.TestLuigiFromBinPath).Single();
            var rom  = Rom.AsSpecificRomType <LuigiFormatRom>(Rom.Create(path, null));

            Assert.NotNull(rom);
            var metadataBlock = rom.LocateDataBlock <LuigiMetadataBlock>();

            Assert.Null(metadataBlock);

            var information = new LuigiFileMetadataProgramInformation(rom.Header, metadataBlock);

            Assert.Throws <InvalidOperationException>(() => information.AddCrc(1u, "version", IncompatibilityFlags.None));
        }
        public void LuigiFileMetadataProgramInformation_CreateWithNoMetadatda_VerifySetYear()
        {
            var path = LuigiFileMetadataProgramInformationTestStorageAccess.Initialize(TestRomResources.TestLuigiFromBinPath).Single();
            var rom  = Rom.AsSpecificRomType <LuigiFormatRom>(Rom.Create(path, null));

            Assert.NotNull(rom);
            var metadataBlock = rom.LocateDataBlock <LuigiMetadataBlock>();

            Assert.Null(metadataBlock);
            var information = new LuigiFileMetadataProgramInformation(rom.Header, metadataBlock);

            Assert.Null(information.Year);

            var testYear = "1989";

            information.Year = testYear;
            Assert.Equal(testYear, information.Year);
        }
        public void LuigiFileMetadataProgramInformation_CreateWithNoMetadatda_VerifySetFeatures()
        {
            var path = LuigiFileMetadataProgramInformationTestStorageAccess.Initialize(TestRomResources.TestLuigiFromBinPath).Single();
            var rom  = Rom.AsSpecificRomType <LuigiFormatRom>(Rom.Create(path, null));

            Assert.NotNull(rom);
            var metadataBlock = rom.LocateDataBlock <LuigiMetadataBlock>();

            Assert.Null(metadataBlock);
            var information     = new LuigiFileMetadataProgramInformation(rom.Header, metadataBlock);
            var currentFeatures = information.Features;

            Assert.NotNull(currentFeatures);

            var testFeatures = currentFeatures.Clone();

            testFeatures.Ecs     = EcsFeatures.Printer;
            information.Features = testFeatures;

            Assert.NotEqual(testFeatures, currentFeatures);
            Assert.True(object.ReferenceEquals(testFeatures, information.Features));
        }