Advertisement
IvetValcheva

Untitled

Dec 7th, 2022
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.63 KB | None | 0 0
  1. using BarberShop;
  2. using NUnit.Framework;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5.  
  6. public class Test_25
  7. {
  8.     private BarberShop.BarberShop barberShop;
  9.     private Barber b1 = new Barber("a", 1, 1);
  10.     private Barber b2 = new Barber("b", 2, 3);
  11.     private Barber b3 = new Barber("c", 2, 2);
  12.  
  13.     private Client c1 = new Client("a", 1, Gender.MALE);
  14.     private Client c2 = new Client("b", 1, Gender.FEMALE);
  15.     private Client c3 = new Client("c", 2, Gender.FEMALE);
  16.     private Client c4 = new Client("d", 6, Gender.FEMALE);
  17.     private Client c5 = new Client("e", 5, Gender.FEMALE);
  18.  
  19.     [SetUp]
  20.     public void Setup()
  21.     {
  22.         this.barberShop = new BarberShop.BarberShop();
  23.     }
  24.  
  25.     [Test]
  26.     public void TestGetClientsSortedByAgeDescAndBarbersStarsDesc()
  27.     {
  28.         this.barberShop.AddBarber(b1);
  29.         this.barberShop.AddBarber(b2);
  30.         this.barberShop.AddBarber(b3);
  31.         this.barberShop.AddClient(c1);
  32.         this.barberShop.AddClient(c2);
  33.         this.barberShop.AddClient(c3);
  34.         this.barberShop.AddClient(c4);
  35.         this.barberShop.AddClient(c5);
  36.         this.barberShop.AssignClient(b1, c1);
  37.         this.barberShop.AssignClient(b1, c3);
  38.         this.barberShop.AssignClient(b2, c2);
  39.         this.barberShop.AssignClient(b2, c4);
  40.         this.barberShop.AssignClient(b3, c5);
  41.  
  42.         var res = this.barberShop.GetClientsSortedByAgeDescAndBarbersStarsDesc().ToList();
  43.         var expected = new List<Client>() { c4, c5, c3, c2, c1 };
  44.  
  45.         for (int i = 0; i < res.Count(); i++)
  46.         {
  47.             Assert.AreEqual(res[i].Name, expected[i].Name);
  48.         }
  49.     }
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement