public void RatingCalculator_GuidId()
        {
            var settingsMock = new Mock<ISettings>();
            var repositoryMock = new Mock<IRepository>();
            var uowMock = new Mock<IUnitOfWork>();
            var serviceLocatorMock = new Mock<IServiceLocator>();
            serviceLocatorMock.Setup(r => r.GetInstance<IRepository>())
                .Returns(repositoryMock.Object);

            ServiceLocator.SetLocatorProvider(() => serviceLocatorMock.Object);

            // Arrange data
            Guid id = Guid.NewGuid();
            User user = new User { Id = id };

            Booking booking = new Booking
            {
                Id = Guid.NewGuid(),
                Specialist = user
            };

            Call call1 = new Call
            {
                Id = Guid.NewGuid(),
                Booking = booking,
                Rating = 2
            };
            Call call2 = new Call
            {
                Id = Guid.NewGuid(),
                Booking = booking,
                Rating = 4
            };

            User[] users = new User[] { user };
            repositoryMock.Setup(r => r.Query<User>()).Returns(users.AsQueryable());

            Booking[] bookings = new Booking[] { booking };
            repositoryMock.Setup(r => r.Query<Booking>()).Returns(bookings.AsQueryable());

            Call[] calls = new Call[] { call1, call2 };
            repositoryMock.Setup(r => r.Query<Call>()).Returns(calls.AsQueryable());

            double expectedValue = 3;

            // Act
            var bookingService = new BookingService(uowMock.Object, repositoryMock.Object, settingsMock.Object);
            double currentValue = bookingService.RatingCalculator(id);

            // Assert
            repositoryMock.Verify(r => r.Query<Call>());//.Where(c=>c.Booking.Specialist.Id == id));
            Assert.AreEqual(expectedValue, currentValue);
        }
        public void RatingCalculator_NullCall()
        {
            // Setup Dependence
            var settingsMock = new Mock<ISettings>();
            var repositoryMock = new Mock<IRepository>();
            var uowMock = new Mock<IUnitOfWork>();
            var serviceLocatorMock = new Mock<IServiceLocator>();
            serviceLocatorMock.Setup(r => r.GetInstance<IRepository>())
                .Returns(repositoryMock.Object);

            ServiceLocator.SetLocatorProvider(() => serviceLocatorMock.Object);

            // Arrange data
            Guid id = Guid.NewGuid();
            User user = new User { Id = id };
            repositoryMock.Setup(r => r.Query<Booking>()).Returns(new List<Booking>().AsQueryable());

            double expectedValue = 0;

            // Act
            var bookingService = new BookingService(uowMock.Object, repositoryMock.Object, settingsMock.Object);
            double currentValue = bookingService.RatingCalculator(id);

            // Assert
            repositoryMock.Verify(r => r.Query<Call>());
            Assert.AreEqual(expectedValue, currentValue);
        }