Пример #1
0
        public void CheckForValidInsuranceShouldReturnNullOnEmptyCollection()
        {
            var repository = new Mock <IDeletableEntityRepository <Vehicle> >();
            var service    = new VehiclesService(repository.Object);
            var vehicle    = new Vehicle
            {
                Policies = new List <Policy>(),
            };

            Assert.Null(service.CheckForValidInsurance(vehicle));
        }
Пример #2
0
        public void CheckForValidInsuranceShouldReturnCorrectString()
        {
            var    repository = new Mock <IDeletableEntityRepository <Vehicle> >();
            var    service    = new VehiclesService(repository.Object);
            string policyId   = "test";
            var    vehicle    = new Vehicle
            {
                Policies = new List <Policy>
                {
                    new Policy {
                        Id = policyId, IsValid = true
                    },
                },
            };

            Assert.Equal(policyId, service.CheckForValidInsurance(vehicle));
        }
Пример #3
0
        public void CheckForValidInsuranceShouldReturnNullOnCollectionWithInvalidPolicies()
        {
            var    repository = new Mock <IDeletableEntityRepository <Vehicle> >();
            var    service    = new VehiclesService(repository.Object);
            string policyId   = "test";
            var    vehicle    = new Vehicle
            {
                Policies = new List <Policy>
                {
                    new Policy {
                        Id = policyId, IsValid = false
                    },
                },
            };

            Assert.Null(service.CheckForValidInsurance(vehicle));
        }