Advertisement
IvetValcheva

Test 29

Dec 12th, 2022
675
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.87 KB | None | 0 0
  1. using NUnit.Framework;
  2. using System;
  3. using System.Linq;
  4. using System.Collections.Generic;
  5. using System.Diagnostics;
  6. using CouponOps;
  7. using CouponOps.Models;
  8.  
  9. [TestFixture]
  10. public class CouponTests29
  11. {
  12.  
  13.     private CouponOperations couponOperations;
  14.     private Website w1;
  15.     private Website w2;
  16.     private Website w3;
  17.     private Website w4;
  18.     private Website w5;
  19.     private Website w6;
  20.     private Coupon c1;
  21.     private Coupon c2;
  22.     private Coupon c3;
  23.     private Coupon c4;
  24.     private Coupon c5;
  25.  
  26.     [SetUp]
  27.     public void Setup()
  28.     {
  29.         this.couponOperations = new CouponOperations();
  30.         this.w1 = new Website("a", 1);
  31.         this.w2 = new Website("b", 2);
  32.         this.w3 = new Website("c", 2);
  33.         this.w4 = new Website("d", 4);
  34.         this.w5 = new Website("e", 5);
  35.         this.w6 = new Website("f", 6);
  36.         this.c1 = new Coupon("a", 1, 3);
  37.         this.c2 = new Coupon("b", 1, 2);
  38.         this.c3 = new Coupon("c", 1, 1);
  39.         this.c4 = new Coupon("d", 2, 3);
  40.         this.c5 = new Coupon("e", 0, 3);
  41.     }
  42.    
  43.     [Test]
  44.     public void TestGetWebsitesOrderedByUserCountAndCouponsCountDesc1()
  45.     {
  46.         this.couponOperations.RegisterSite(w3);
  47.         this.couponOperations.RegisterSite(w4);
  48.         this.couponOperations.RegisterSite(w5);
  49.         this.couponOperations.RegisterSite(w1);
  50.         this.couponOperations.RegisterSite(w2);
  51.  
  52.         this.couponOperations.AddCoupon(w1, c1);
  53.         this.couponOperations.AddCoupon(w2, c2);
  54.         this.couponOperations.AddCoupon(w2, c3);
  55.         this.couponOperations.AddCoupon(w2, c4);
  56.         this.couponOperations.AddCoupon(w2, c5);
  57.  
  58.         var res = this.couponOperations.GetWebsitesOrderedByUserCountAndCouponsCountDesc();
  59.         var expected = new List<Website>() { w1, w2, w3, w4, w5 };
  60.         CollectionAssert.AreEqual(res, expected);
  61.     }
  62. }
  63.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement