Ejemplo n.º 1
0
        public void ShouldCreateXmlFile()
        {
            // Arrange
            var testCaseExecution = new TestCaseExecution();

            testCaseExecution.Name    = "TestCase01";
            testCaseExecution.Ended   = DateTime.Now.AddDays(1);
            testCaseExecution.Started = DateTime.Now;
            testCaseExecution.Status  = ExecutionStatus.Failed;
            testCaseExecution.Steps   = new TestStepCollection()
            {
                new LoadAssemblyStep(),
                new SetClassStep(),
                new FormattingStep(),
                new ExecuteMethodStep(),
                new ExecuteMethodStep(),
                new FormattingStep(),
                new ExecuteMethodStep()
            };
            var xml = testCaseExecution.ToXml();

            // Act
            testCaseRepository.AddExecution("testCaseName", testCaseExecution);

            // Assert
            Mock.Get(fileSystemRepository)
            .Verify(r => r.CreateFile("Root\\testCaseName\\Executions\\TestCase01.xml", xml), Times.Once());
        }
Ejemplo n.º 2
0
        public void Test_ShouldMapExecutionFile()
        {
            // Arrange
            var dummy = new TestCaseExecution();

            dummy.Started = DateTime.Now.AddDays(-1);
            dummy.Ended   = DateTime.Now;
            var xml   = dummy.ToXml();
            var file  = NewFile("file1.xml", xml, DateTime.Now.AddDays(-2));
            var files = new File[] { file };

            Mock.Get(fileSystemRepository)
            .Setup(r => r.FetchAllFiles("Root\\TestCase01\\Executions"))
            .Returns(files);

            // Act
            var testCase  = testCaseRepository.Get("TestCase01");
            var execution = testCase.Executions.First();

            // Assert
            execution.Name.ShouldEqual("file1");
            execution.Started.ShouldEqual(dummy.Started);
            execution.Ended.ShouldEqual(dummy.Ended);
            execution.CreatedDateTime.ShouldEqual(file.CreatedDateTime);
        }
Ejemplo n.º 3
0
        public void AddExecution(string testCaseName, TestCaseExecution execution)
        {
            var filePath = Path.Combine(this.path, testCaseName, "Executions", execution.Name + ".xml");
            var file     = fileSystemRepository.CreateFile(filePath, execution.ToXml());

            execution.CreatedDateTime = file.CreatedDateTime;
        }
Ejemplo n.º 4
0
 public void UpdateExecution(string testCaseName, TestCaseExecution execution)
 {
     var filePath = Path.Combine(this.path, testCaseName, "Executions", execution.Name + ".xml");
     var file     = fileSystemRepository.UpdateFile(filePath, execution.ToXml());
 }