|
| 1 | +namespace Schema.NET.Benchmarks.Core |
| 2 | +{ |
| 3 | + using System; |
| 4 | + using System.Collections.Generic; |
| 5 | + using BenchmarkDotNet.Attributes; |
| 6 | + |
| 7 | + public class BookBenchmark : SchemaBenchmarkBase |
| 8 | + { |
| 9 | + [GlobalSetup] |
| 10 | + public void Setup() => this.ConfigureBenchmark(new Book() |
| 11 | + { |
| 12 | + Id = new Uri("http://example.com/book/1"), |
| 13 | + Name = "The Catcher in the Rye", |
| 14 | + Author = new Person() |
| 15 | + { |
| 16 | + Name = "J.D. Salinger" |
| 17 | + }, |
| 18 | + Url = new Uri("http://www.barnesandnoble.com/store/info/offer/JDSalinger"), |
| 19 | + WorkExample = new List<ICreativeWork>() |
| 20 | + { |
| 21 | + new Book() |
| 22 | + { |
| 23 | + Isbn = "031676948", |
| 24 | + BookEdition = "2nd Edition", |
| 25 | + BookFormat = BookFormatType.Hardcover, |
| 26 | + PotentialAction = new ReadAction() |
| 27 | + { |
| 28 | + Target = new EntryPoint() |
| 29 | + { |
| 30 | + UrlTemplate = "http://www.barnesandnoble.com/store/info/offer/0316769487?purchase=true", |
| 31 | + ActionPlatform = new List<Uri>() |
| 32 | + { |
| 33 | + new Uri("https://schema.org/DesktopWebPlatform"), |
| 34 | + new Uri("https://schema.org/IOSPlatform"), |
| 35 | + new Uri("https://schema.org/AndroidPlatform") |
| 36 | + } |
| 37 | + }, |
| 38 | + ExpectsAcceptanceOf = new Offer() |
| 39 | + { |
| 40 | + Price = 6.99M, |
| 41 | + PriceCurrency = "USD", |
| 42 | + EligibleRegion = new Country() |
| 43 | + { |
| 44 | + Name = "US" |
| 45 | + }, |
| 46 | + Availability = ItemAvailability.InStock |
| 47 | + } |
| 48 | + }, |
| 49 | + }, |
| 50 | + new Book() |
| 51 | + { |
| 52 | + Isbn = "031676947", |
| 53 | + BookEdition = "1st Edition", |
| 54 | + BookFormat = BookFormatType.EBook, |
| 55 | + PotentialAction = new ReadAction() |
| 56 | + { |
| 57 | + Target = new EntryPoint() |
| 58 | + { |
| 59 | + UrlTemplate = "http://www.barnesandnoble.com/store/info/offer/031676947?purchase=true", |
| 60 | + ActionPlatform = new List<Uri>() |
| 61 | + { |
| 62 | + new Uri("https://schema.org/DesktopWebPlatform"), |
| 63 | + new Uri("https://schema.org/IOSPlatform"), |
| 64 | + new Uri("https://schema.org/AndroidPlatform") |
| 65 | + } |
| 66 | + }, |
| 67 | + ExpectsAcceptanceOf = new Offer() |
| 68 | + { |
| 69 | + Price = 1.99M, |
| 70 | + PriceCurrency = "USD", |
| 71 | + EligibleRegion = new Country() |
| 72 | + { |
| 73 | + Name = "UK" |
| 74 | + }, |
| 75 | + Availability = ItemAvailability.InStock |
| 76 | + } |
| 77 | + }, |
| 78 | + } |
| 79 | + } |
| 80 | + }); |
| 81 | + } |
| 82 | +} |
0 commit comments