Example #1
0
        internal static void Arg_OutRefDefault()
        {
            Tools.Asserter.Is(default(int), Arg.AnyRef <int>().Var);
            Tools.Asserter.Is(default(int), Arg.WhereRef <int>(null).Var);

            Tools.Asserter.Is(default(string), Arg.AnyRef <string>().Var);
            Tools.Asserter.Is(default(string), Arg.WhereRef <string>(null).Var);
        }
Example #2
0
        internal static void Fake_HandlesOut(string data)
        {
            Fake <OutSample> fake = Tools.Faker.Mock <OutSample>();

            fake.Setup(
                d => d.ReturnVoid(out Arg.AnyRef <string>().Var),
                Behavior.Set((OutRef <string> d) => { d.Var = data; }, Times.Once));

            fake.Dummy.ReturnVoid(out string value);

            Tools.Asserter.Is(data, value);
            fake.VerifyAll(Times.Once);
        }
Example #3
0
        internal static void Issue003_FakeHandlesOut(Fake <RefHolder> sample, int testValue, int result)
        {
            sample.Setup(
                d => d.TestMethodA(out Arg.AnyRef <int>().Var),
                Behavior.Set((OutRef <int> v) =>
            {
                v.Var = testValue;
                return(result);
            }));

            sample.Dummy.TestMethodA(out int newValue).Assert().Is(result);
            sample.VerifyAll();
            newValue.Assert().Is(testValue);
        }
Example #4
0
        internal static void Issue003_FakeHandlesRef(Fake <RefHolder> sample, int result)
        {
            int testValue = 0;

            sample.Setup(
                d => d.TestMethodB(ref Arg.AnyRef <int>().Var),
                Behavior.Set((OutRef <int> v) =>
            {
                v.Var -= 5;
                return(result);
            }));

            sample.Dummy.TestMethodB(ref testValue).Assert().Is(result);
            sample.VerifyAll();
            testValue.Assert().Is(-5);
        }