Exemple #1
0
        public void ReviewListGetByIdTest()
        {
            var ratingList = new ReviewList();

            var guid1 = Guid.NewGuid();
            var guid2 = Guid.NewGuid();
            var guid3 = Guid.NewGuid();

            ratingList.Add(new Review(1, "Name1", "Description1", 2));
            ratingList.Add(new Review(2, "Name2", "Description2", 3));
            ratingList.Add(new Review(3, "Name3", "Description3", 4));

            var rating = ratingList.GetbyId(0);

            Assert.AreEqual(rating, null);

            rating = ratingList.GetbyId(-1);
            Assert.AreEqual(rating, null);

            rating = ratingList.GetbyId(1);
            Assert.AreEqual(rating.Name, "Name1");

            rating = ratingList.GetbyId(2);
            Assert.AreEqual(rating.Name, "Name2");

            rating = ratingList.GetbyId(3);
            Assert.AreEqual(rating.Name, "Name3");
        }