Beispiel #1
0
        public void TestJSONDeserialize(string Object)
        {
            List <Car> CompareModel = new List <Car>();
            BMWCreator model        = new BMWCreator();

            CompareModel.Add(model.Create("BMW", "D1", "compartment", "Automatic", "eletro", "4", "120", "ClimateControl", "leather"));
            JSONDeserialize test    = new JSONDeserialize(Object);
            BMWCreator      compare = new BMWCreator();
            List <Car>      Model   = new List <Car>();

            Model = test.Deserialize();
            Assert.AreEqual(Model, CompareModel);
        }
Beispiel #2
0
        public void TestFind(string result)
        {
            JSONDeserialize test    = new JSONDeserialize(result);
            List <Car>      list    = new List <Car>();
            BMW             car1    = new BMW("BMW", "D2", "compartment", "Automatic", "eletro", "4", "120", "ClimateControl", "leather");
            BMW             car2    = new BMW("BMW", "D1", "compartment", "Automatic", "eletro", "4", "120", "ClimateControl", "leather");
            BMW             car3    = new BMW("BMW", "D3", "compartment", "Automatic", "eletro", "4", "120", "ClimateControl", "leather");
            List <Car>      catalog = new List <Car>();

            catalog.Add(car1);
            catalog.Add(car2);
            catalog.Add(car3);
            list = test.Deserialize();
            int i = 0;

            foreach (EnteredCar element in list)
            {
                FindCar findcar = new FindCar(catalog, element);
                i = findcar.Find();
            }
            Assert.AreEqual(2, i);
        }