Example #1
0
      public async Task sponsored_toss_displayed_randomly_among_users()
      {
          await _mediator.Send(new TossCreateCommand()
            {
                Content = "lorem ipsum erzer zer zer ze rze rezr zer from user 1 #toto",
                SponsoredDisplayedCount = 10,
                StripeChargeToken       = "AAA"
            });

          await TestFixture.ChangeCurrentUser("test2");

          await _mediator.Send(new TossCreateCommand()
            {
                Content = "lorem ipsum erzer zer zer ze rze rezr zer from user 2 #toto",
                SponsoredDisplayedCount = 10,
                StripeChargeToken       = "AAA"
            });


          RandomFake.NextResults.Enqueue(0);  //first user selection
          RandomFake.NextResults.Enqueue(0);  //first toss selection
          RandomFake.NextResults.Enqueue(1);  //second user selection
          RandomFake.NextResults.Enqueue(0);  //second toss selection

          var res = await _mediator.Send(new SponsoredTossQuery("toto"));

          Assert.Contains("user 1", res.Content);

          res = await _mediator.Send(new SponsoredTossQuery("toto"));

          Assert.Contains("user 2", res.Content);
      }