Example #1
0
        public void Bitwise_PreMutation(string methodName, object argument1, object argument2, uint expected)
        {
            // Arrange
            var binary = DllTestHelper.CompileTestBinary(_folder);

            // Act
            using (var binaryInteractor = new DllTestHelper(binary))
            {
                var actual = (uint)binaryInteractor.DynamicMethodCall(_nameSpace, methodName.FirstCharToUpper(),
                                                                      new[] { argument1, argument2 });

                // Assert
                Assert.AreEqual(expected, actual);
            }
        }
Example #2
0
        public void BooleanBranch_PreMutation(string methodName, object expectedReturn)
        {
            // Arrange
            var binary   = DllTestHelper.CompileTestBinary(_folder);
            var expected = true;

            // Act

            using (var binaryInteractor = new DllTestHelper(binary))
            {
                var actual = (bool)binaryInteractor.DynamicMethodCall(_nameSpace, methodName.FirstCharToUpper(),
                                                                      new[] { expectedReturn });

                // Assert
                Assert.AreEqual(expected, actual);
            }
        }
Example #3
0
        public void Boolean_Variable_PostMutation(string methodName, bool expected, bool simplify)
        {
            // Arrange
            var binary = DllTestHelper.CompileTestBinary(_folder);

            // Act
            var mutatedBinary =
                DllTestHelper.MutateMethodVariables <VariableMutationAnalyzer>(binary, methodName, simplify);

            using (var binaryInteractor = new DllTestHelper(mutatedBinary))
            {
                var actual =
                    (bool)binaryInteractor.DynamicMethodCall(_nameSpace, methodName.FirstCharToUpper(),
                                                             new object[] { });

                // Assert
                Assert.AreEqual(expected, actual);
            }
        }
Example #4
0
        public void Bitwise_PostMutation(string methodName, object argument1, object argument2,
                                         string expectedOpCodeName, uint expected)
        {
            // Arrange
            var binary         = DllTestHelper.CompileTestBinary(_folder);
            var opCodeExpected = expectedOpCodeName.ParseOpCode();

            // Act
            var mutatedBinary =
                DllTestHelper.MutateMethod <BitwiseMutationAnalyzer>(binary, methodName, opCodeExpected);

            using (var binaryInteractor = new DllTestHelper(mutatedBinary))
            {
                var actual = (uint)binaryInteractor.DynamicMethodCall(_nameSpace, methodName.FirstCharToUpper(),
                                                                      new[] { argument1, argument2 });

                // Assert
                Assert.AreEqual(expected, actual);
            }
        }
Example #5
0
        public void BooleanBranch_PostMutation(string methodName, string expectedOpCodeName, object argument1,
                                               bool simplify)
        {
            // Arrange
            var binary         = DllTestHelper.CompileTestBinary(_folder);
            var expected       = false;
            var opCodeExpected = expectedOpCodeName.ParseOpCode();

            // Act
            var mutatedBinary =
                DllTestHelper.MutateMethod <BooleanBranchMutationAnalyzer>(binary, methodName, opCodeExpected, simplify);

            using (var binaryInteractor = new DllTestHelper(mutatedBinary))
            {
                var actual =
                    (bool)binaryInteractor.DynamicMethodCall(_nameSpace, methodName.FirstCharToUpper(),
                                                             new[] { argument1 });

                // Assert
                Assert.AreEqual(expected, actual);
            }
        }
Example #6
0
        public void Array_PostMutation(string methodName)
        {
            // Arrange
            var binary = DllTestHelper.CompileTestBinary(_folder);

            object original;
            object actual;

            // Act
            using (var originalInteractor = new DllTestHelper(binary))
            {
                original = originalInteractor.DynamicMethodCall(_nameSpace, methodName, null);
            }

            var mutatedBinary = DllTestHelper.MutateArray <ArrayMutationAnalyzer>(binary, methodName);

            using (var binaryInteractor = new DllTestHelper(mutatedBinary))
            {
                actual = binaryInteractor.DynamicMethodCall(_nameSpace, methodName, null);
            }

            // Assert
            Assert.AreNotEqual(original, actual);
        }