public DateTimeExtensionsTest() { spec = Substitute.ForPartsOf <FuzzyRange <DateTime> >(fuzzy, DateTime.MinValue, DateTime.MaxValue); FuzzyContext.Set(value, spec); ConfiguredCall arrange = fuzzy.Build(spec).Returns(newValue); }
public Int16ExtensionsTest() { spec = Substitute.ForPartsOf <FuzzyRange <short> >(fuzzy, short.MinValue, short.MaxValue); FuzzyContext.Set(value, spec); ConfiguredCall arrange = fuzzy.Build(spec).Returns(newValue); }
public StringExtensionsTest() { spec = new FuzzyString(fuzzy); FuzzyContext.Set(value, spec); ConfiguredCall arrange = fuzzy.Build(spec).Returns(newValue); }
void ArrangeBuildOfFuzzyRange <T>(Func <T> generate) where T : struct, IComparable <T> { ConfiguredCall arrange = fuzzy.Build(Arg.Any <FuzzyRange <T> >()) .Returns(call => { T initial = generate(); FuzzyContext.Set(initial, (FuzzyRange <T>)call[0]); return(initial); }); }
public IComparableExtensionsTest() { value = new TestStruct(random.Next()); spec = Substitute.ForPartsOf<FuzzyRange<TestStruct>>(fuzzy, new TestStruct(int.MinValue), new TestStruct(int.MaxValue)); minimum = new TestStruct(int.MinValue + random.Next() % short.MaxValue); maximum = new TestStruct(int.MaxValue - random.Next() % short.MaxValue); newValue = new TestStruct(random.Next()); FuzzyContext.Set(value, spec); ConfiguredCall arrange = fuzzy.Build(spec).Returns(newValue); }
T IFuzz.Build <T>(Fuzzy <T> spec) { if (spec is null) { throw new System.ArgumentNullException(nameof(spec)); } T value = spec.Build(); FuzzyContext.Set(value, spec); return(value); }