public void Get_SeveralVisits_ReturnsTotalVisitsCount(int visitCount, ITracker tracker, [Frozen] IContactProfileProvider contactProfileProvider, VisitsRepository visitsRepository)
    {
      //Arrange
      this.InitTracker(tracker);
      contactProfileProvider.Contact.Returns(x => tracker.Contact);
      tracker.Contact.System.VisitCount.Returns(visitCount);

      using (new TrackerSwitcher(tracker))
      {
        //Act
        var visits = visitsRepository.Get();
        //Assert      
        visits.TotalVisits.Should().Be(visitCount);
      }
    }
    public void Get_Value_ReturnsEngagementValue(int value, ITracker tracker, [Frozen] IContactProfileProvider contactProfileProvider, VisitsRepository visitsRepository)
    {
      //Arrange
      this.InitTracker(tracker);
      contactProfileProvider.Contact.Returns(x => tracker.Contact);
      tracker.Contact.System.Value.Returns(value);

      using (new TrackerSwitcher(tracker))
      {
        //Act
        var visits = visitsRepository.Get();
        //Assert      
        visits.EngagementValue.Should().Be(value);
      }
    }
    public void Get_PageViews_DoNotReturnCancelledPages(ITracker tracker, [Frozen] IContactProfileProvider contactProfileProvider, VisitsRepository visitsRepository)
    {
      //Arrange
      this.InitTracker(tracker);
      var pages = new List<ICurrentPageContext>
                  {
                    this.GeneratePage(false),
                    this.GeneratePage(true),
                    this.GeneratePage(false)
                  };
      tracker.Interaction.GetPages().Returns(pages);
      contactProfileProvider.Contact.Returns(x => tracker.Contact);
      ;

      using (new TrackerSwitcher(tracker))
      {
        //Act
        var visits = visitsRepository.Get();
        //Assert 
        visits.PageViews.Should().HaveCount(2);
        visits.TotalPageViews.Should().Be(2);
      }
    }
    public void Get_PageViews_ReturnReversedPages(ITracker tracker, [Frozen] IContactProfileProvider contactProfileProvider, VisitsRepository visitsRepository)
    {
      //Arrange
      this.InitTracker(tracker);
      var pages = new List<ICurrentPageContext>
                  {
                    this.GeneratePage(path: "/0"),
                    this.GeneratePage(path: "/1"),
                    this.GeneratePage(path: "/2")
                  };
      tracker.Interaction.GetPages().Returns(pages);
      contactProfileProvider.Contact.Returns(x => tracker.Contact);

      using (new TrackerSwitcher(tracker))
      {
        //Act
        var visits = visitsRepository.Get();
        //Assert 
        visits.PageViews.Select(x => x.Path).Should().BeEquivalentTo("2", "1", "0");
      }
    }
    public void Get_PageViews_ReturnOnly10Pages(ITracker tracker, [Frozen] IContactProfileProvider contactProfileProvider, VisitsRepository visitsRepository)
    {
      //Arrange
      this.InitTracker(tracker);
      var pages = Enumerable.Repeat(this.GeneratePage(), 15);
      tracker.Interaction.GetPages().Returns(pages);
      contactProfileProvider.Contact.Returns(x => tracker.Contact);
      ;

      using (new TrackerSwitcher(tracker))
      {
        //Act
        var visits = visitsRepository.Get();
        //Assert 
        visits.PageViews.Should().HaveCount(10);
        visits.TotalPageViews.Should().Be(15);
      }
    }