Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using NUnit.Framework;
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Diagnostics;
- using CouponOps;
- using CouponOps.Models;
- [TestFixture]
- public class CouponTests29
- {
- private CouponOperations couponOperations;
- private Website w1;
- private Website w2;
- private Website w3;
- private Website w4;
- private Website w5;
- private Website w6;
- private Coupon c1;
- private Coupon c2;
- private Coupon c3;
- private Coupon c4;
- private Coupon c5;
- [SetUp]
- public void Setup()
- {
- this.couponOperations = new CouponOperations();
- this.w1 = new Website("a", 1);
- this.w2 = new Website("b", 2);
- this.w3 = new Website("c", 2);
- this.w4 = new Website("d", 4);
- this.w5 = new Website("e", 5);
- this.w6 = new Website("f", 6);
- this.c1 = new Coupon("a", 1, 3);
- this.c2 = new Coupon("b", 1, 2);
- this.c3 = new Coupon("c", 1, 1);
- this.c4 = new Coupon("d", 2, 3);
- this.c5 = new Coupon("e", 0, 3);
- }
- [Test]
- public void TestGetWebsitesOrderedByUserCountAndCouponsCountDesc1()
- {
- this.couponOperations.RegisterSite(w3);
- this.couponOperations.RegisterSite(w4);
- this.couponOperations.RegisterSite(w5);
- this.couponOperations.RegisterSite(w1);
- this.couponOperations.RegisterSite(w2);
- this.couponOperations.AddCoupon(w1, c1);
- this.couponOperations.AddCoupon(w2, c2);
- this.couponOperations.AddCoupon(w2, c3);
- this.couponOperations.AddCoupon(w2, c4);
- this.couponOperations.AddCoupon(w2, c5);
- var res = this.couponOperations.GetWebsitesOrderedByUserCountAndCouponsCountDesc();
- var expected = new List<Website>() { w1, w2, w3, w4, w5 };
- CollectionAssert.AreEqual(res, expected);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement