Esempio n. 1
0
 def test_equals(self):
     # ARRANGE #
     phase_name = 'expected_phase'
     instruction_name = 'expected_instruction'
     expected = sut.TestCasePhaseInstructionCrossReference(
         phase_name, instruction_name)
     actual = sut.TestCasePhaseInstructionCrossReference(
         phase_name, instruction_name)
     # ASSERT #
     self.assertEqual(expected, actual)
Esempio n. 2
0
 def test_not_equals_of_same_type(self):
     # ARRANGE #
     expected_phase = 'expected_phase'
     expected_instruction = 'expected_instruction'
     expected = sut.TestCasePhaseInstructionCrossReference(
         expected_phase, expected_instruction)
     actuals = [
         sut.TestCasePhaseInstructionCrossReference('actual_phase',
                                                    expected_instruction),
         sut.TestCasePhaseInstructionCrossReference(expected_phase,
                                                    'actual_instruction'),
     ]
     for actual in actuals:
         with self.subTest(actual=actual):
             self.assertNotEqual(expected, actual)
Esempio n. 3
0
 def test_visit_TestCasePhaseInstructionCrossReference(self):
     # ARRANGE #
     x = sut.TestCasePhaseInstructionCrossReference('phase name',
                                                    'instruction name')
     visitor = VisitorThatRegistersVisitedClassesAndReturnsTheArgument()
     # ACT #
     returned = visitor.visit(x)
     # ASSERT #
     self.assertEqual([sut.TestCasePhaseInstructionCrossReference],
                      visitor.visited_classes)
     self.assertIs(
         x, returned,
         'The object itself is expected to be returned by the visitor')
Esempio n. 4
0
 def test_not_equals_for_every_type(self):
     expected = sut.TestCasePhaseInstructionCrossReference(
         'expected_phase', 'expected_instruction')
     for actual in ACTUAL_CROSS_REF_ID_OF_EVERY_TYPE:
         with self.subTest(actual=actual):
             self.assertNotEqual(expected, actual)
Esempio n. 5
0
        instruction_name = 'expected_instruction'
        expected = sut.TestSuiteSectionInstructionCrossReference(
            section_name, instruction_name)
        actual = sut.TestSuiteSectionInstructionCrossReference(
            section_name, instruction_name)
        # ASSERT #
        self.assertEqual(expected, actual)


ACTUAL_CROSS_REF_ID_OF_EVERY_TYPE = [
    sut.CustomCrossReferenceId('actual'),
    sut.EntityCrossReferenceId(
        entity_type_names('actual_entity_identifier',
                          'actual presentation name'), 'actual'),
    sut.TestCasePhaseCrossReference('actual'),
    sut.TestCasePhaseInstructionCrossReference('actual_phase',
                                               'actual_instruction'),
    sut.TestSuiteSectionCrossReference('actual'),
    sut.TestSuiteSectionInstructionCrossReference('actual_section',
                                                  'actual_instruction'),
]


class CrossReferenceIdVisitorTest(unittest.TestCase):
    def test_visit_Url(self):
        # ARRANGE #
        x = sut.UrlCrossReferenceTarget('the url')
        visitor = VisitorThatRegistersVisitedClassesAndReturnsTheArgument()
        # ACT #
        returned = visitor.visit(x)
        # ASSERT #
        self.assertEqual([sut.UrlCrossReferenceTarget],