Esempio n. 1
0
        public void AllUnitAbbreviationsImplemented(string cultureName)
        {
            List <object> unitValuesMissingAbbreviations = new List <object>()
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues <AngleUnit>()))
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues <AreaUnit>()))
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues <DurationUnit>()))
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName,
                                                                                                        EnumUtils.GetEnumValues <ElectricPotentialUnit>()))
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues <FlowUnit>()))
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues <ForceUnit>()))
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues <LengthUnit>()))
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues <MassUnit>()))
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues <PressureUnit>()))
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues <RotationalSpeedUnit>()))
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues <SpeedUnit>()))
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues <TemperatureUnit>()))
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues <TorqueUnit>()))
                                                           .Concat(GetUnitTypesWithMissingAbbreviations(cultureName, EnumUtils.GetEnumValues <VolumeUnit>()))
                                                           .ToList();

            // We want to flag if any localizations are missing, but not break the build
            // or flag an error for pull requests. For now they are not considered
            // critical and it is cumbersome to have a third person review the pull request
            // and add in any translations before merging it in.
            if (unitValuesMissingAbbreviations.Any())
            {
                string unitsWithNoAbbrev = string.Join(", ",
                                                       unitValuesMissingAbbreviations.Select(unitValue => unitValue.GetType().Name + "." + unitValue).ToArray());

                string message = "Units missing abbreviations: " + unitsWithNoAbbrev;
                _output.WriteLine(message);
            }
            Assert.Empty(unitValuesMissingAbbreviations);
        }