Example #1
0
        private TestCaseDefinition NewDefinition(DateTime created)
        {
            var result = new TestCaseDefinition();

            result.CreatedDateTime = created;
            return(result);
        }
Example #2
0
        public void AddDefinition(string testCaseName, TestCaseDefinition definition)
        {
            var filePath = Path.Combine(this.path, testCaseName, "Definitions", definition.Name + ".txt");
            var file     = fileSystemRepository.CreateFile(filePath, definition.Definition);

            definition.CreatedDateTime = file.CreatedDateTime;
        }
Example #3
0
 public TestCaseDefinitionViewModel(TestCaseDefinition definition)
 {
     this.definition      = definition;
     this.Name            = definition.Name;
     this.CreatedDateTime = definition.CreatedDateTime;
     this.Definition      = definition.Definition;
 }
Example #4
0
        public void ShouldSetCreatedDateTime()
        {
            // Arrange
            createdFile.CreatedDateTime = DateTime.Now;
            var testCaseDefinition = new TestCaseDefinition();

            testCaseDefinition.Name = "TestCaseDefinition01";

            // Act
            testCaseRepository.AddDefinition("testCaseName", testCaseDefinition);

            // Assert
            testCaseDefinition.CreatedDateTime.ShouldEqual(createdFile.CreatedDateTime);
        }
Example #5
0
        public void ShouldCreateTxtFile()
        {
            // Arrange
            var testCaseDefinition = new TestCaseDefinition();

            testCaseDefinition.Name       = "TestCase01";
            testCaseDefinition.Definition = "Definition01";

            // Act
            testCaseRepository.AddDefinition("testCaseName", testCaseDefinition);

            // Assert
            Mock.Get(fileSystemRepository)
            .Verify(r => r.CreateFile("Root\\testCaseName\\Definitions\\TestCase01.txt", "Definition01"), Times.Once());
        }
Example #6
0
        private IEnumerable <TestCaseDefinition> GetTestCaseDefinitions(string testCaseName)
        {
            var result          = new List <TestCaseDefinition>();
            var definitionsPath = Path.Combine(this.path, testCaseName, "Definitions");
            var definitionFiles = this.fileSystemRepository.FetchAllFiles(definitionsPath);

            foreach (var definition in definitionFiles)
            {
                var tcd = new TestCaseDefinition();
                tcd.CreatedDateTime = definition.CreatedDateTime;
                tcd.Definition      = definition.Contents;
                tcd.Name            = Path.GetFileNameWithoutExtension(definition.Name);
                result.Add(tcd);
            }

            return(result);
        }
Example #7
0
        protected override async Task AfterTestCaseStartingAsync()
        {
            await base.AfterTestCaseStartingAsync();

            try
            {
                // create the test class instance
                _test = new Test(TestCase, null, TestCase.Method, DisplayName);
                var timer = new ExecutionTimer();
                _testClassInstance = _test.CreateTestClass(TestClass, ConstructorArguments, MessageBus, timer, CancellationTokenSource);

                // discover the other tests
                _testCaseDefinition = new TestCaseDefinition(new TestCaseWithoutTraits(TestCase), _testClassInstance, _classFixtureMappings);
                _testCaseDefinition.DiscoverTestCaseComponents();
            }
            catch (Exception ex)
            {
                _testCaseDiscoveryException = ex;
            }
        }
Example #8
0
        public void ShouldSortByCreatedDateTime()
        {
            // Arrange
            var definition1 = NewDefinition(created: DateTime.Today.AddDays(-3));
            var definition2 = NewDefinition(created: DateTime.Today.AddDays(-2));
            var definition3 = NewDefinition(created: DateTime.Today.AddDays(-1));
            var definitions = new TestCaseDefinition[]
            {
                definition1,
                definition2,
                definition3
            };

            // Act
            testCase.Definitions = definitions;

            // Assert
            var result = testCase.Definitions.ToList();

            result[0].ShouldEqual(definition3);
            result[1].ShouldEqual(definition2);
            result[2].ShouldEqual(definition1);
        }