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);
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        public void AllEnumValues_ValidEnum_ReturnsAllValues()
        {
            var values = EnumUtils.AllEnumValues <UtilsTest>();

            values.Should().BeEquivalentTo(new[] { UtilsTest.Zero, UtilsTest.One, UtilsTest.Two });
        }
Exemple #4
0
 public void AllEnumValues_NotAnEnum_ThrowsException()
 {
     Assert.Throws <ArgumentException>(() => EnumUtils.AllEnumValues <int>());
 }
Exemple #5
0
 public IEnumerable <BrothMicrodilutionStandard> Standards(SpeciesTestingMethod testingMethod)
 {
     return(EnumUtils.AllEnumValues <BrothMicrodilutionStandard>().Where(t => t != BrothMicrodilutionStandard.None));
 }
Exemple #6
0
 public IEnumerable <BrothMicrodilutionStandard> Standards(SpeciesTestingMethod testingMethod)
 {
     _standards.TryGetValue(testingMethod, out var standards);
     return(standards ?? EnumUtils.AllEnumValues <BrothMicrodilutionStandard>().Where(t => t != BrothMicrodilutionStandard.None));
 }