public void EnumerableThreeAndTwoRangeEquals() { var combiner = new Combiner(ThreeIntegers.OfType <object>(), TwoIntegers.OfType <object>()) { SilentOverflow = true }; // Which should Iterate over the Enumerable of Object[] Combinations. Assert.Equal(ExpectedThreeAndTwoCombos, combiner); }
public void VerifyStronglyTypedCombine() { // ReSharper disable RedundantTypeArgumentsOfMethod var combiner = FourCharacters.Combine <char, int>(TwoIntegers); VerifyAspect(combiner , x => Assert.Equal(FourCharacters.OfType <object>(), x) , x => Assert.Equal(TwoIntegers.OfType <object>(), x) ); }
public void VerifyStronglyTypedCombine() { #pragma warning disable IDE0001 // Name can be simplified // ReSharper disable RedundantTypeArgumentsOfMethod var combiner = FourCharacters.Combine <char, int>(TwoIntegers); #pragma warning restore IDE0001 // Name can be simplified VerifyAspect(combiner , x => x.AssertEqual(FourCharacters.OfType <object>()) , x => x.AssertEqual(TwoIntegers.OfType <object>()) ); }
public void ExtensionThreeAndTwoYieldSix() { var first = ThreeIntegers.ToArray(); var second = TwoIntegers.ToArray(); var combiner = first.Combine(second); Assert.Equal(first.Length * second.Length, combiner.Count); VerifyAspect(combiner , x => Assert.Equal(first.OfType <object>(), x) , x => Assert.Equal(second.OfType <object>(), x) ); }
public void OverflowEventuallyThrows() { void IterateUntilOverflow() { var combiner = TwoIntegers.Combine(ThreeIntegers); for (; !combiner.Exhausted; ++combiner) { } // TODO: TBD: need to figure out how better to deal with the indexing at the edges... particular when reaching the "maxed out" or "last" edge case. // TODO: TBD: for now, the "simplest" thing to do is increment one more time after having shorted out at the last case. // ReSharper disable once RedundantAssignment combiner++; } // We can see this as an "Action" although there is no implicit type conversion as such. Assert.Throws <InvalidOperationException>((Action)IterateUntilOverflow); }