Exemple #1
0
        public void GetByVinShouldReturnNullOnEmptyCollection()
        {
            var repository = new Mock <IDeletableEntityRepository <Vehicle> >();

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

            Assert.Null(service.GetByVin(randomVIN));
        }
Exemple #2
0
        public void GetByVinShouldReturnNotNullOnExistingVIN()
        {
            var repository = new Mock <IDeletableEntityRepository <Vehicle> >();

            repository.Setup(r => r.All()).Returns(new List <Vehicle>
            {
                new Vehicle()
                {
                    VIN = "WAUZZZ1KZ8N123456"
                },
            }.AsQueryable());
            var    service     = new VehiclesService(repository.Object);
            string existingVIN = "WAUZZZ1KZ8N123456";

            Assert.NotNull(service.GetByVin(existingVIN));
        }