public void WhenStandardsNotConfigured_ReturnsAllValues() { var expectedStandards = EnumUtils.AllEnumValues <BrothMicrodilutionStandard>().ToList(); expectedStandards.Remove(BrothMicrodilutionStandard.None); var sut = CreateSut(Options.Create(new BreakpointSettings())); var standards = sut.Standards(SpeciesTestingMethod.ETest); standards.Should().BeEquivalentTo(expectedStandards); }
public static string GetEnumDescription <TEnum>(TEnum value) { if (value == null) { return(string.Empty); } if (!EnumUtils.IsFlagsEnum <TEnum>()) { return(EnumUtils.GetEnumDescription <TEnum>(value)); } var integerValue = (int)(object)value; var descriptions = EnumUtils.AllEnumValues <TEnum>().Cast <int>() .Where(enumValue => enumValue != 0 && (enumValue & integerValue) == enumValue) .Select(enumValue => EnumUtils.GetEnumDescription <TEnum>(enumValue)).ToList(); return(string.Join(", ", descriptions)); }
public void AllEnumValues_ValidEnum_ReturnsAllValues() { var values = EnumUtils.AllEnumValues <UtilsTest>(); values.Should().BeEquivalentTo(new[] { UtilsTest.Zero, UtilsTest.One, UtilsTest.Two }); }
public void AllEnumValues_NotAnEnum_ThrowsException() { Assert.Throws <ArgumentException>(() => EnumUtils.AllEnumValues <int>()); }
public IEnumerable <BrothMicrodilutionStandard> Standards(SpeciesTestingMethod testingMethod) { return(EnumUtils.AllEnumValues <BrothMicrodilutionStandard>().Where(t => t != BrothMicrodilutionStandard.None)); }
public IEnumerable <BrothMicrodilutionStandard> Standards(SpeciesTestingMethod testingMethod) { _standards.TryGetValue(testingMethod, out var standards); return(standards ?? EnumUtils.AllEnumValues <BrothMicrodilutionStandard>().Where(t => t != BrothMicrodilutionStandard.None)); }