Example #1
0
        public void InferFragmentType_AssignmentWithParameterNonFragment_ReturnsNoFragmentType()
        {
            TypeNode            intTypeNode      = IntrospectionTools.TypeNodeFactory <int>();
            Method              sample           = TestHelper.GetSample <InferFragmentSample>("AssignmentWithParameter", intTypeNode);
            Block               assignmentBlock  = (Block)sample.Body.Statements[0];
            AssignmentStatement assignment       = (AssignmentStatement)assignmentBlock.Statements[1];
            Expression          sampleExpression = assignment.Source;
            string              fragmentType     = _symbolTable.InferFragmentType(sampleExpression);

            Assert.That(fragmentType, Is.EqualTo(EmptyFragment));
        }
Example #2
0
        public void InferFragmentType_AssignmentWithParameterFragmentSetToTrue_InfersFragmentType()
        {
            _symbolTable.MakeSafe("parameter", "DummyType");
            TypeNode            intTypeNode      = IntrospectionTools.TypeNodeFactory <int>();
            Method              sample           = TestHelper.GetSample <InferFragmentSample>("AssignmentWithParameter", intTypeNode);
            Block               assignmentBlock  = (Block)sample.Body.Statements[0];
            AssignmentStatement assignment       = (AssignmentStatement)assignmentBlock.Statements[1];
            Expression          sampleExpression = assignment.Source;
            string              fragmentType     = _symbolTable.InferFragmentType(sampleExpression);

            Assert.That(fragmentType, Is.EqualTo("DummyType"));
        }