Пример #1
0
        public void Plant_FlowerInPot_Throws()
        {
            // arrange
            var source     = new PlantSource(Plants.Hedera, SeedType.Seedling);
            var flowerMock = new Mock <Flower>(source);

            flowerMock.Setup(x => x.GetPot(It.IsAny <DateTime>())).Returns(new Pot());
            var flowerInPot = flowerMock.Object;

            // act
            new Planting(flowerInPot, new Soil(""), new Pot());
        }
Пример #2
0
        public void CanNotPlant_ToNonEmptyPot()
        {
            // arrange
            var source  = new PlantSource(Plants.Hedera, SeedType.Seedling);
            var potMock = new Mock <Pot>();

            potMock.Setup(x => x.GetFlower(It.IsAny <DateTime>())).Returns(new Flower(source));
            var potWithFlower = potMock.Object;

            // act
            new Planting(new Flower(source), new Soil(""), potWithFlower);
        }
Пример #3
0
        public void Planting_Flower_ItIsInPot()
        {
            var pot    = new Pot("");
            var source = new PlantSource(Plants.Hedera, SeedType.Seedling);

            // act
            var flower = new Flower(source, new Soil(""), pot);

            //new Planting(flower, pot);

            Assert.AreEqual(pot, flower.CurrentPot);
            Assert.AreEqual(flower, pot.CurrentFlower);
        }
Пример #4
0
        //public static void ReadConfig(IConfiguration configuration)
        //{
        //    BeiKeUrl = configuration["Proxys:BeiKe"];
        //    JiGuangUrl = configuration["Proxys:JiGuang"];
        //    ZhiMaUrl = configuration["Proxys:ZhiMa"];
        //    FeiZhuUrl = configuration["Proxys:FeiZhu"];
        //}

        static ProxyManager()
        {
            var op = new MemoryCacheOptions();

            _MemoryCache    = new MemoryCache(Options.Create(new MemoryCacheOptions()));
            _proxyHosts     = new Stack <string>();
            _stPlantSources = new Stack <PlantSource>();
            //初始化代理平台
            var pss = Enum.GetValues(typeof(PlantSource));

            foreach (var v in pss)
            {
                PlantSource ps = (PlantSource)Enum.Parse(typeof(PlantSource), v.ToString());
                _stPlantSources.Push(ps);
            }
        }
Пример #5
0
 public Planting(PlantSource source, Soil soil, Pot pot)
     : this(new Flower(source), soil, pot)
 {
 }