public void TestCreate()
        {
            ResidentialFactory rf = new ResidentialFactory();
            Residential        r  = rf.create("Hotel", 1000, 10, 15, 30);

            Assert.AreEqual("Hotel", r.getName());
        }
Ejemplo n.º 2
0
        public void BeforeAll()
        {
            var residentialFactory = new ResidentialFactory();

            _tradeableProperty = residentialFactory.create("Test Residential", 200, 50, 50, "Red");
            _player            = new Player("Josh", 500);
            _banker            = Banker.Access();
        }
 public void testResidential()
 {
     //create instance of factory
     ResidentialFactory f = new ResidentialFactory();
     //create instance from factory
     Residential p = f.create("Residential", 50, 50, 50);
     //check that it is right type
     Type t = new Residential().GetType();
     Assert.IsInstanceOfType(t, p);
 }
        public void test_residential()
        {
            //create instance of factory
            ResidentialFactory f = new ResidentialFactory();
            //create instance from factory
            Residential p = f.create("Residential", 50, 50, 50, "Red");
            //check that it is right type
            Type t = new Residential().GetType();

            Assert.IsInstanceOfType(t, p);
        }
        public void CreateProperties()
        {
            var resFactory     = new ResidentialFactory();
            var transFactory   = new TransportFactory();
            var utilFactory    = new UtilityFactory();
            var genericFactory = new PropertyFactory();
            var luckFactory    = new LuckFactory();


            try
            {
                var propertyDetails = _fileReader.ReadPropertyDetailsFromCSV();

                // Add the properties to the board
                foreach (var propertyDetail in propertyDetails)
                {
                    switch (propertyDetail.Type.ToLower())
                    {
                    case "luck":
                        Board.Access()
                        .AddProperty(luckFactory.create(propertyDetail.Name, propertyDetail.IsPenalty,
                                                        propertyDetail.Amount));
                        break;

                    case "residential":
                        Board.Access()
                        .AddProperty(resFactory.create(propertyDetail.Name, propertyDetail.Price,
                                                       propertyDetail.Rent, propertyDetail.HouseCost, propertyDetail.HouseColour));
                        break;

                    case "transport":
                        Board.Access().AddProperty(transFactory.create(propertyDetail.Name));
                        break;

                    case "utility":
                        Board.Access().AddProperty(utilFactory.create(propertyDetail.Name));
                        break;

                    case "generic":
                        Board.Access().AddProperty(genericFactory.Create(propertyDetail.Name));
                        break;
                    }
                }

                Console.WriteLine("Properties have been setup");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Oops, something went wrong setting up the properties: {0}", ex.Message);
            }
        }
        public void TestgetPropertiesOwnedFromBoard()
        {
            ResidentialFactory resFactory = new ResidentialFactory();
            Board.access().addPlayer(testPlayer);
            testPlayer.setBalance(1000);
            Board.access().addProperty(resFactory.create("Te Puke, Giant Kiwifruit", 60, 6, 50));
            testPlayer.setLocation(0, false);
            TradeableProperty propertyLocatedOn = (TradeableProperty)Board.access().getProperty(testPlayer.getLocation());
            propertyLocatedOn.purchase(ref testPlayer);

            Assert.IsNotNull(testPlayer.getPropertiesOwned());
        }