Exemplo n.º 1
0
 public void MyTestInitialize()
 {
     maison  = new Residence(0.0616m);
     ampoule = new Appareil("Ampoule 100 Watts", 100);
     plinthe = new Appareil("Plinthe chauffante", 1000);
     maison.ajouterUtilisation(600, ampoule);
     maison.ajouterUtilisation(90, plinthe);
 }
Exemplo n.º 2
0
        public void Residence_TestExtraction()
        {
            List <Appareil> extraction = maison.extraireAppareils(0.0);

            Assert.IsNotNull(extraction);
            Assert.AreEqual(2, extraction.Count);
            Assert.IsTrue(extraction.Contains(plinthe));
            Assert.IsTrue(extraction.Contains(ampoule));

            extraction = maison.extraireAppareils(1.25);
            Assert.IsNotNull(extraction);
            Assert.AreEqual(2, extraction.Count);
            Assert.IsTrue(extraction.Contains(plinthe));
            Assert.IsTrue(extraction.Contains(ampoule));

            extraction = maison.extraireAppareils(2.0);
            Assert.IsNotNull(extraction);
            Assert.AreEqual(1, extraction.Count);
            Assert.IsTrue(extraction.Contains(ampoule));

            extraction = maison.extraireAppareils(11.0);
            Assert.IsNotNull(extraction);
            Assert.AreEqual(0, extraction.Count);

            maison.ajouterUtilisation(60, plinthe);
            extraction = maison.extraireAppareils(1.0);
            Assert.IsNotNull(extraction);
            Assert.AreEqual(2, extraction.Count);
            Assert.IsTrue(extraction.Contains(ampoule));
            Assert.IsTrue(extraction.Contains(plinthe));

            extraction = maison.extraireAppareils(1.25);
            Assert.IsNotNull(extraction);
            Assert.AreEqual(2, extraction.Count);
            Assert.IsTrue(extraction.Contains(ampoule));
            Assert.IsTrue(extraction.Contains(plinthe));

            extraction = maison.extraireAppareils(0.5);
            Assert.IsNotNull(extraction);
            Assert.AreEqual(2, extraction.Count);
            Assert.IsTrue(extraction.Contains(ampoule));
            Assert.IsTrue(extraction.Contains(plinthe));

            extraction = maison.extraireAppareils(3);
            Assert.IsNotNull(extraction);
            Assert.AreEqual(1, extraction.Count);
            Assert.IsTrue(extraction.Contains(ampoule));
        }