public void CaseSensitiveReturnsIEnumerableWithSameValues() { var result = SmartFlagTestEnum.FromName("One, Two", false).ToList(); Assert.Equal("One", result[0].Name); Assert.Equal("Two", result[1].Name); }
public void ReturnsIEnumerableWithSameValuesZeroTest() { var result = SmartFlagTestEnum.FromName("Zero, One").ToList(); Assert.Equal("Zero", result[0].Name); Assert.Equal("One", result[1].Name); }
public void ReturnsIEnumerableWithSingleValidValue() { SmartFlagTestEnum.TryFromValue(1, out var TEnum); var list = TEnum.ToList(); Assert.Single(TEnum); Assert.Equal("One", list[0].Name); }
public void OrBitwiseOperatorReturnsIEnumerableWithTwoSameValues() { SmartFlagTestEnum.TryFromValue(SmartFlagTestEnum.One | SmartFlagTestEnum.Two, out var enumList); var list = enumList.ToList(); Assert.Equal(2, enumList.Count()); Assert.Equal("One", list[0].Name); Assert.Equal("Two", list[1].ToString()); }
public void ReturnsIEnumerableWithTwoValidValues() { SmartFlagTestEnum.TryFromValue(3, out var Tenum); var list = Tenum.ToList(); Assert.Equal(2, Tenum.Count()); Assert.Equal("One", list[0].Name); Assert.Equal("Two", list[1].Name); }
public void OrBitwiseOperatorReturnsIEnumerableWithThreeSameValues() { SmartFlagTestEnum.TryFromValue((SmartFlagTestEnum.One | SmartFlagTestEnum.Two | SmartFlagTestEnum.Three), out var output); var list = output.ToList(); Assert.Equal("One", list[0].Name); Assert.Equal("Two", list[1].Name); Assert.Equal("Three", list[2].Name); }
public void ReturnsIEnumerableWithSameValuesKeyboardBashTest() { var result = SmartFlagTestEnum.FromName("Five, Four, Three, One, Two, Zero, Other, Values, Ignored, asd, sdf, dfg ,dfg,asd,dfg,sadf,gh,dfgh,afd,asd,asd,af,asf,asf,,asffgfdg,,sdfg,sdg,sd,g,sdf,xcv,cvb,xzcv,asdf,ghdfcg,xc,asdf,asd,dfg,xcvb,asdf,asd,sfg,dfg,xcvb,szxdf,as,fdxc,v,sdf,sdf,sdf,sdf,xdc,sfdg,cvb,dfg,vbcndfg,sdf,das,vxc,gfds,asdf,afds,dgs", false).ToList(); Assert.Equal("Zero", result[0].Name); Assert.Equal("One", result[1].Name); Assert.Equal("Two", result[2].Name); Assert.Equal("Three", result[3].Name); Assert.Equal("Four", result[4].Name); Assert.Equal("Five", result[5].Name); }
public void ReturnsIEnumerableWithSameValues() { var result = SmartFlagTestEnum.FromName("Five, Four, Three, One, Two, Zero, Other, Values, Ignored", false).ToList(); Assert.Equal("Zero", result[0].Name); Assert.Equal("One", result[1].Name); Assert.Equal("Two", result[2].Name); Assert.Equal("Three", result[3].Name); Assert.Equal("Four", result[4].Name); Assert.Equal("Five", result[5].Name); }
public void ReturnsAllWhenGivenInputNegativeOne() { var result = SmartFlagTestEnum.FromValue(-1).ToList(); Assert.Equal(5, result.Count); Assert.Equal("One", result[0].Name); Assert.Equal("Two", result[1].Name); Assert.Equal("Three", result[2].Name); Assert.Equal("Four", result[3].Name); Assert.Equal("Five", result[4].Name); }
public void ThrowsExceptionWhenEnumIsAboveAllowableRangeFromValue() { Assert.Throws <SmartEnumNotFoundException>(() => SmartFlagTestEnum.FromValue(32)); }
public void EqualsSmartEnumReturnsExpected(SmartFlagTestEnum left, object right, bool expected) { var result = left.Equals(right); result.Should().Be(expected); }
public void ReturnsStringWithFourValidValues() { var result = SmartFlagTestEnum.FromValueToString(15); Assert.Equal("One, Two, Three, Four", result); }
public void ReturnsStringWithSingleValidValue() { var result = SmartFlagTestEnum.FromValueToString(16); Assert.Equal("Five", result); }
public void ReturnsFormattedNameAndValue(SmartFlagTestEnum smartEnum) { var result = smartEnum.ToString(); result.Should().Be(smartEnum.Name); }
public void GreaterThanOrEqualReturnsExpected(SmartFlagTestEnum left, SmartFlagTestEnum right, bool lessThan, bool equalTo, bool greaterThan) { var result = left >= right; result.Should().Be(greaterThan || equalTo); }
public void FromValueHighNumberToStringThrowsSmartEnumNotFoundException() { Assert.Throws <SmartEnumNotFoundException>(() => SmartFlagTestEnum.FromValueToString(124)); }
public void ReturnValidStringValues(int inputValue, string outputValue) { var result = SmartFlagTestEnum.FromValueToString(inputValue); Assert.Equal(outputValue, result); }
public void LessThanReturnsExpected(SmartFlagTestEnum left, SmartFlagTestEnum right, bool lessThan, bool equalTo, bool greaterThan) { var result = left < right; result.Should().Be(lessThan); }
public void DoesNothingIfEnumValuesArePositive() { SmartFlagTestEnum.FromValue(3); }
public void NotEqualOperatorReturnsExpected(SmartFlagTestEnum left, SmartFlagTestEnum right, bool expected) { var result = left != right; result.Should().Be(!expected); }
public void ThrowsExceptionGivenOutOfRangeValue() { Assert.Throws <SmartEnumNotFoundException>(() => SmartFlagTestEnum.FromName("Invalid, Value")); }
public void DoesNothingIfValueEqualsMaximumValue_BoundaryValueTest() { var result = SmartFlagTestEnum.FromValue(31); }
public void DoesNothingIfEnumValuesArePowerOfTwo() { SmartFlagTestEnum.FromValue(3); }
public void OrBitwiseOperatorReturnsStringWithThreeSameValues() { var result = SmartFlagTestEnum.FromValueToString((SmartFlagTestEnum.One | SmartFlagTestEnum.Two | SmartFlagTestEnum.Three)); Assert.Equal("One, Two, Three", result); }
public void ZeroValueReturnsIEnumerableWithZeroValueEnum() { var result = SmartFlagTestEnum.FromValue(0).ToList(); Assert.Equal("Zero", result[0].Name); }
public void CompareToReturnsExpected(SmartFlagTestEnum left, SmartFlagTestEnum right, int expected) { var result = left.CompareTo(right); result.Should().Be(expected); }