Helpers.cs 913 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using FluentAssertions;
  5. using QuestPDF.Infrastructure;
  6. using QuestPDF.UnitTests.TestEngine;
  7. namespace QuestPDF.UnitTests
  8. {
  9. public static class Helpers
  10. {
  11. public static Random Random = new Random();
  12. public static Size RandomSize => new Size(Random.Next(200, 400), Random.Next(100, 200));
  13. public static void ShouldEqual(this IEnumerable<OperationBase> commands, IEnumerable<OperationBase> expected)
  14. {
  15. commands.Should().HaveSameCount(expected);
  16. commands
  17. .Zip(expected)
  18. .ToList()
  19. .ForEach(x =>
  20. {
  21. x.First.Should().BeOfType(x.Second.GetType());
  22. x.First.Should().BeEquivalentTo(x.Second, y => y.RespectingRuntimeTypes());
  23. });
  24. }
  25. }
  26. }