コード例 #1
0
        public void GetApplicableGLassesByProductType_ShouldReturnNeededItems()
        {
            string productType = "windscreen";
            var    vehicle     = new Vehicle()
            {
                MakeId         = 1,
                ModelId        = 1,
                BodyTypeId     = 1,
                VehicleGlasses = new List <VehicleGlass>()
                {
                    new VehicleGlass()
                    {
                        Id = 1, ProductType = productType
                    },
                    new VehicleGlass()
                    {
                        Id = 2, ProductType = "test"
                    },
                    new VehicleGlass()
                    {
                        Id = 3, ProductType = productType
                    }
                }
            };

            var repositoryMock = new Mock <IInternalDbRepository <Vehicle> >();

            var service = new VehiclesService(repositoryMock.Object);

            var response = service.GetApplicableGLassesByProductType(vehicle, productType).ToList();

            Assert.AreEqual(response.Count, 2);
            Assert.AreEqual(response[0].Id, 1);
            Assert.AreEqual(response[1].Id, 3);
        }