public void UserSpecifiedProgramInformation_ConstructWithMetadataProgramInformationWithPopulatedMetadataFields_ContainsExpectedData(string shortName) { var sourceInformation = new TestProgramInformationMetadata() { Title = "Sumpin' Mysteriouser", Vendor = "Somewhat Mysterious, Inc.", Year = "1989", ShortName = shortName, Features = new ProgramFeaturesBuilder().WithEcsFeatures(EcsFeatures.Synthesizer).Build() as ProgramFeatures }; sourceInformation.AddCrc(0x24680246, null, IncompatibilityFlags.KeyboardComponent); sourceInformation.AddCrc(0x13579135, "(fast)", IncompatibilityFlags.Tutorvision); sourceInformation.SetOrigin(ProgramInformationOrigin.UpdateFragment); var dateTimeBuilder = new MetadataDateTimeBuilder(1999); sourceInformation.AddReleaseDate(dateTimeBuilder.WithMonth(1).WithDay(2).Build()); sourceInformation.AddReleaseDate(dateTimeBuilder.WithDay(3).Build()); sourceInformation.AddBuildDate(dateTimeBuilder.WithDay(1).Build()); sourceInformation.AddBuildDate(dateTimeBuilder.WithDay(2).Build()); foreach (var fieldId in TestProgramInformationMetadata.StringFieldIds) { var stringValue = fieldId.ToString(); sourceInformation.AddMetadataValue(fieldId, stringValue + " #1"); sourceInformation.AddMetadataValue(fieldId, stringValue + " #2"); } var information = new UserSpecifiedProgramInformation(sourceInformation); Assert.False(information.IsModified); VerifyInformation(sourceInformation, information); }
public void SetAllMetadata() { var dateTimeBuilder = new MetadataDateTimeBuilder(1999); AddReleaseDate(dateTimeBuilder.WithMonth(1).WithDay(2).Build()); AddReleaseDate(dateTimeBuilder.WithDay(3).Build()); AddBuildDate(dateTimeBuilder.WithDay(1).Build()); AddBuildDate(dateTimeBuilder.WithDay(2).Build()); foreach (var fieldId in TestProgramInformationMetadata.StringFieldIds) { var stringValue = fieldId.ToString(); AddMetadataValue(fieldId, stringValue); } }
public void MetadataDateTimeBuilder_WithAllValidValues_CreatesExpectedMetadataDateTime() { var year = 2018; var month = 10; var day = 15; var hour = 17; var minute = 34; var second = 48; var offsetHours = 1; var offsetMinutes = 23; var flags = Enum.GetValues(typeof(MetadataDateTimeFlags)).Cast <MetadataDateTimeFlags>().Aggregate((all, flag) => all | flag) & ~MetadataDateTimeFlags.LeapSecond; var offset = new TimeSpan(offsetHours, offsetMinutes, 0); var date = new System.DateTimeOffset(year, month, day, hour, minute, second, offset); var expectedMetadataDateTime = new MetadataDateTime(date, flags); var builder = new MetadataDateTimeBuilder(year); builder.WithMonth(month).WithDay(day).WithHour(hour).WithMinute(minute).WithSecond(second).WithOffset(offsetHours, offsetMinutes); var actualMetadataDateTime = builder.Build(); Assert.Equal(0, expectedMetadataDateTime.CompareTo(actualMetadataDateTime, strict: true, compareOnlyCommonValidFields: false)); }