public void Write_Steps_With_Screen_Annotations()
        {
            // arrange
            var usecase = new UseCase
            {
                Name = "Screen Annotations",
                Description = "Usecase to show the screen annotations",
                Status = "failed",
            };

            writer.SaveUseCase(usecase);

            var scenario = new Scenario
            {
                Name = "All screen annotations on one page",
                Description = "this is a typical scenario with a decription",
                Status = "failed",
            };

            writer.SaveScenario(usecase.Name, scenario);
            writer.Flush();

            // act
            var step = new Step();
            var stepDescription = new StepDescription { Index = StepIndex, Title = "Test Step", Status = "success" };
            step.StepDescription = stepDescription;

            step.StepHtml = new StepHtml { HtmlSource = "<html>just some page text</html>" };
            step.Page = new Page { Name = "Sample Screen Annotation Page" };
            step.StepDescription.ScreenshotFileName = "000.png";
            step.StepDescription.Index = 0;

            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(10, 50, ScreenAnnotationStyle.Highlight));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(10, 150, ScreenAnnotationStyle.Click, ScreenAnnotationClickAction.ToUrl, "next-url"));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(10, 250, ScreenAnnotationStyle.Error));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(10, 350, ScreenAnnotationStyle.Expected));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(10, 450, ScreenAnnotationStyle.Info));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(400, 50, ScreenAnnotationStyle.Keyboard));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(400, 150, ScreenAnnotationStyle.Warn));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(400, 250, ScreenAnnotationStyle.Default));
            step.ScreenAnnotations.Add(DataGenerator.CreateScreenAnnotation(400, 350, ScreenAnnotationStyle.NavigateToUrl, ScreenAnnotationClickAction.ToUrl, "blabla"));

            var details = new Details();
            details.AddDetail("details-key", "details-value");
            step.ScreenAnnotations.Last().Details = details;

            writer.SaveStep(usecase.Name, scenario.Name, step);
            writer.Flush();

            writer.SaveScreenshot(usecase.Name, scenario.Name, step, File.ReadAllBytes("data/screenshot.png"));
            writer.Flush();

            usecase.Status = "success";
            scenario.Status = "success";

            writer.SaveUseCase(usecase);
            writer.SaveScenario(usecase.Name, scenario);

            var stepAsString = File.ReadAllText(docuFiles.GetScenarioStepFile(BranchName, BuildName, usecase.Name, scenario.Name, 0));

            // well this is a really sloppy assertion. BUT: we don't have to test the whole serialization because this is done by .NET framework.
            // we have to do some little things that the java deserializer likes our xml. So we do just some checks on "problem zones". the whole
            // import should still be checked with an api call on the scenarioo backend.
            StringAssert.Contains("<style>HIGHLIGHT</style>", stepAsString);
            StringAssert.Contains("<style>CLICK</style>", stepAsString);
            StringAssert.Contains("<style>ERROR</style>", stepAsString);
            StringAssert.Contains("<style>INFO</style>", stepAsString);
            StringAssert.Contains("<style>EXPECTED</style>", stepAsString);
        }
        private Step CreateBigDataStepForLoadTestAsyncWriting(int index)
        {
            var step = new Step();

            // Description
            var stepDescription = new StepDescription
                                      {
                                          Index = index,
                                          ScreenshotFileName =
                                              docuFiles.GetScreenshotFile(
                                                  BranchName,
                                                  BuildName,
                                                  SerializationUseCase,
                                                  ScenarioName,
                                                  index),
                                          Title =
                                              "this is a step with a lot of data in it such that writing should take realy long for testing async writing\n"
                                      };

            step.StepDescription = stepDescription;

            // Metdata with a lot of details
            step.StepMetadata = CreateBigMetadata();

            // Page
            step.Page = new Page("test.jsp");

            // Creates HTML (lot of dummy data, just to generate big data for writing)
            step.StepHtml = CreateBigHtml();

            return step;
        }
        public void Serialize_A_Step()
        {
            // arrange
            var step = new Step();
            var stepDescription = new StepDescription { Index = StepIndex, Title = "Test Step", Status = "success" };
            step.StepDescription = stepDescription;

            step.StepHtml = new StepHtml { HtmlSource = "<html>just some page text</html>" };
            step.Page = new Page { Name = "customer/overview.jsp" };

            step.StepMetadata = new StepMetadata
                                   {
                                       VisibleText = "just some page text",
                                   };

            // act
            writer.SaveStep(SerializationUseCase, TestContext.CurrentContext.Test.Name, step);
            writer.Flush();

            // assert
            Assert.IsTrue(File.Exists(docuFiles.GetScenarioStepFile(BranchName, BuildName, SerializationUseCase, TestContext.CurrentContext.Test.Name, 1)));
        }