Пример #1
0
        public void GetMyVehiclesShouldReturnEmptyListOnEmptyRepository()
        {
            var repository = new Mock <IDeletableEntityRepository <Vehicle> >();

            repository.Setup(r => r.All()).Returns(new List <Vehicle>().AsQueryable());
            var    service        = new VehiclesService(repository.Object);
            string randomClientId = "test";

            Assert.Equal(0, service.GetMyVehicles(randomClientId).Count);
        }
Пример #2
0
        public void GetMyVehiclesShouldReturnCorrectCountOnNonEmptyRepositoryIfVehicleExist()
        {
            var repository = new Mock <IDeletableEntityRepository <Vehicle> >();

            repository.Setup(r => r.All()).Returns(new List <Vehicle>
            {
                new Vehicle()
                {
                    OwnerId = "Pesho"
                },
                new Vehicle()
                {
                    OwnerId = "Gosho"
                },
            }.AsQueryable());
            var    service          = new VehiclesService(repository.Object);
            string existingClientId = "Pesho";

            Assert.Equal(1, service.GetMyVehicles(existingClientId).Count);
        }