#pragma warning restore 1591 /// <summary> /// Returns a <see cref="Theme"/> Color from it's enum /// </summary> /// <param name="themeEnum">The enum to get the color from</param> /// <returns>A theme color</returns> public static Color FromIdentifier(this Theme.Identifier themeEnum) { return(themeEnum switch { Identifier.TealPrimary => TealPrimary, Identifier.TealPrimaryLight => TealPrimaryLight, Identifier.TealPrimaryAir => TealPrimaryAir, Identifier.TealSecondary => TealSecondary, Identifier.TealSecondaryLight => TealSecondaryLight, Identifier.TealSecondaryAir => TealSecondaryAir, _ => throw new System.NotImplementedException("The enum your are trying to get a color from have not been mapped to a corresponding color."), });
public void Theme_FromIdentifier_IdentifierShouldBeMapped(Theme.Identifier identifier) { Action act = () => Theme.FromIdentifier(identifier); act.Should().NotThrow(because: $"every identifier for {nameof(Theme)} should be mapped to a corresponding static color that is defined"); }
public void Theme_HasMappedEnumToColor(Theme.Identifier identifier) { var identifierName = Enum.GetName(typeof(Theme.Identifier), identifier); typeof(Theme).GetField(identifierName, BindingFlags.Static | BindingFlags.Public).Should().NotBeNull(because: $"each identifier for {nameof(Theme)} should have a corresponding static color defined."); }