示例#1
0
        public DateTimeExtensionsTest()
        {
            spec = Substitute.ForPartsOf <FuzzyRange <DateTime> >(fuzzy, DateTime.MinValue, DateTime.MaxValue);

            FuzzyContext.Set(value, spec);
            ConfiguredCall arrange = fuzzy.Build(spec).Returns(newValue);
        }
示例#2
0
        public Int16ExtensionsTest()
        {
            spec = Substitute.ForPartsOf <FuzzyRange <short> >(fuzzy, short.MinValue, short.MaxValue);

            FuzzyContext.Set(value, spec);
            ConfiguredCall arrange = fuzzy.Build(spec).Returns(newValue);
        }
示例#3
0
        public StringExtensionsTest()
        {
            spec = new FuzzyString(fuzzy);

            FuzzyContext.Set(value, spec);
            ConfiguredCall arrange = fuzzy.Build(spec).Returns(newValue);
        }
示例#4
0
 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);
     });
 }
示例#5
0
        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);
        }
示例#6
0
文件: Fuzz.cs 项目: olegsych/fuzzy
        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);
        }