コード例 #1
0
        private void InitialEnvironment()
        {
            _tShirtService = new Services.Implementation.TShirtService(_tShirtRepository.Object);

            //Set environment
            DontRefactor.Models.TShirt[] list = new TShirt[] {
                new TShirt()
                {
                    Id        = Guid.NewGuid(),
                    Colour    = "Blue",
                    Name      = "Xamarin C# T-Shirt",
                    Price     = 15.0,
                    ShirtText = "C#, Xamarin"
                },
                new TShirt()
                {
                    Id        = Guid.NewGuid(),
                    Colour    = "Black",
                    Name      = "New York Yankees T-Shirt",
                    Price     = 8.0,
                    ShirtText = "NY"
                },
                new TShirt()
                {
                    Id        = Guid.NewGuid(),
                    Colour    = "Green",
                    Name      = "Disney Sleeping Beauty T-Shirt",
                    Price     = 10.0,
                    ShirtText = "Mirror mirror on the wall..."
                }
            };

            _tShirtRepository.Setup(l => l.GetAll()).Returns(list.AsQueryable());
        }
コード例 #2
0
ファイル: ProductTest.cs プロジェクト: bluejaye/BKA
        private void InitialEnvironment()
        {
            _lawnmowerService = new Services.Implementation.LawnmowerService(_lawnmowerRepository.Object);

            //Set environment
            DontRefactor.Models.Lawnmower[] lawnmowerList = new DontRefactor.Models.Lawnmower[] {
                new DontRefactor.Models.Lawnmower()
                {
                    Id             = Guid.NewGuid(),
                    Name           = "Hewlett-Packard Rideable Lawnmower",
                    FuelEfficiency = "Very Low",
                    IsVehicle      = true,
                    Price          = 3000.0
                },
                new DontRefactor.Models.Lawnmower()
                {
                    Id             = Guid.NewGuid(),
                    Name           = "Fisher Price's My First Lawnmower",
                    FuelEfficiency = "Ultimate",
                    IsVehicle      = false,
                    Price          = 45.0
                },
                new DontRefactor.Models.Lawnmower()
                {
                    Id             = Guid.NewGuid(),
                    Name           = "Volkswagen LawnMaster 39000B Lawnmower",
                    FuelEfficiency = "Moderate",
                    IsVehicle      = false,
                    Price          = 1020.0
                }
            };

            _lawnmowerRepository.Setup(l => l.GetAll()).Returns(lawnmowerList.AsQueryable());

            _phoneCaseService = new Services.Implementation.PhoneCaseService(_phoneCaseRepository.Object);

            //Set environment
            DontRefactor.Models.PhoneCase[] phoneCaseList = new PhoneCase[] {
                new PhoneCase()
                {
                    Id          = Guid.NewGuid(),
                    Name        = "Amazon Fire Burgundy Phone Case",
                    Colour      = "Burgundy",
                    Material    = "PVC",
                    TargetPhone = "Amazon Fire",
                    Price       = 14.0
                },
                new PhoneCase()
                {
                    Id          = Guid.NewGuid(),
                    Name        = "Nokia Lumia 920/930/Icon Crimson Phone Case",
                    Colour      = "Red",
                    Material    = "Rubber",
                    TargetPhone = "Nokia Lumia 920/930/Icon",
                    Price       = 10.0
                }
            };

            _phoneCaseRepository.Setup(l => l.GetAll()).Returns(phoneCaseList.AsQueryable());

            _tShirtService = new Services.Implementation.TShirtService(_tShirtRepository.Object);

            //Set environment
            DontRefactor.Models.TShirt[] tShirtList = new TShirt[] {
                new TShirt()
                {
                    Id        = Guid.NewGuid(),
                    Colour    = "Blue",
                    Name      = "Xamarin C# T-Shirt",
                    Price     = 15.0,
                    ShirtText = "C#, Xamarin"
                },
                new TShirt()
                {
                    Id        = Guid.NewGuid(),
                    Colour    = "Black",
                    Name      = "New York Yankees T-Shirt",
                    Price     = 8.0,
                    ShirtText = "NY"
                },
                new TShirt()
                {
                    Id        = Guid.NewGuid(),
                    Colour    = "Green",
                    Name      = "Disney Sleeping Beauty T-Shirt",
                    Price     = 10.0,
                    ShirtText = "Mirror mirror on the wall..."
                }
            };

            _tShirtRepository.Setup(l => l.GetAll()).Returns(tShirtList.AsQueryable());

            _productService = new Services.Implementation.ProductService(_lawnmowerService, _phoneCaseService, _tShirtService);
        }