コード例 #1
0
        public void Method_ModifiedStaticFields_HasSideEffect()
        {
            const string classStaticField = "staticFieldOfClass";
            var          body             = MockBlock.GetMethodBodyThatModifiedStaticFields(classStaticField);
            var          method           = MockMethod.DefaultMethodWithBody(body);

            var sideEffectChecker = new ModifiedStateSideEffect();

            sideEffectChecker.CheckForSideEffects(method);
            var hasSideEffect = sideEffectChecker.HasSideEffects();

            Assert.IsTrue(hasSideEffect);
        }
コード例 #2
0
        public void Method_ModifiedParameters_HasSideEffect()
        {
            const string methodParameter = "param1";
            var          body            = MockBlock.GetMethodBodyThatModifiedMethodParameters(methodParameter);
            var          method          = MockMethod.DefaultMethodWithBody(body);

            var sideEffectChecker = new ModifiedStateSideEffect();

            sideEffectChecker.CheckForSideEffects(method);
            var hasSideEffect = sideEffectChecker.HasSideEffects();

            Assert.IsTrue(hasSideEffect);
        }