Beispiel #1
0
        public void TestMethod_WithReturnType_IncludesRefParameter_MockBehavior_Loose()
        {
            var       stub     = new StubIRefUtils(MockBehavior.Loose);
            IRefUtils refUtils = stub;
            int       i1       = 1;
            int       i2       = 2;

            refUtils.Swap(ref i1, ref i2);
            Assert.AreEqual(1, i1);
            Assert.AreEqual(2, i2);
        }
Beispiel #2
0
        public void TestMethod_Void_IncludesRefParameters()
        {
            var stub = new StubIRefUtils()
                       .Swap <int>((ref int v1, ref int v2) =>
            {
                int temp = v1;
                v1       = v2;
                v2       = temp;
            });

            int i1 = 1;
            int i2 = 2;

            ((IRefUtils)stub).Swap <int>(ref i1, ref i2);
            Assert.AreEqual(2, i1);
            Assert.AreEqual(1, i2);
        }