Пример #1
0
 public void Merchants35()
 {
     string pageSource = Misc.ReadContent("..\\..\\..\\Samples\\TestFiles\\build.php-newdid=73229-gid=17");
     HtmlParser htmlParser = new HtmlParser(pageSource);
     Marketplace marketplace = new Marketplace();
     const int villageId = 73229;
     marketplace.VillageId = villageId;
     htmlParser.ParseMarketplace(marketplace);
     Assert.AreEqual(0, marketplace.AvailableMerchants);
     Assert.AreEqual(20, marketplace.TotalMerchants);
     Assert.AreEqual(2000, marketplace.TotalCarry);
     Village village = new Village(villageId, "some name");
     htmlParser.ParseVillageProduction(village);
     Assert.AreEqual(3736, village.WoodAvailable);
     Assert.AreEqual(1000, village.WoodProduction);
     Assert.AreEqual(3736, village.ClayAvailable);
     Assert.AreEqual(1000, village.ClayProduction);
     Assert.AreEqual(5036, village.IronAvailable);
     Assert.AreEqual(1000, village.IronProduction);
     Assert.AreEqual(15804, village.CropAvailable);
     Assert.AreEqual(442, village.CropProduction);
     Assert.AreEqual(160000, village.CapacityWarehouse);
     Assert.AreEqual(160000, village.CapacityGranary);
 }
 private bool EnoughResources(SendResourcesParameters parameters)
 {
     string url = String.Format(CultureInfo.InvariantCulture, "{0}?newdid={1}", serverInfo.Dorf1Url,
                                parameters.SourceVillageId);
     string pageSource = Http.SendData(url, null, serverInfo.CookieContainer, serverInfo.CookieCollection);
     HtmlParser htmlParser = new HtmlParser(pageSource);
     Village village = new Village(parameters.SourceVillageId, "noName");
     htmlParser.ParseVillageProduction(village);
     if (village.WoodAvailable < parameters.WoodAmount
         || village.ClayAvailable < parameters.ClayAmount
         || village.IronAvailable < parameters.IronAmount
         || village.CropAvailable < parameters.CropAmount)
     {
         return false;
     }
     return true;
 }