Exemplo n.º 1
0
        public void TestWeight()
        {
            Plecak Backpack2 = new Plecak(50, 60, 60);
            var    res       = Backpack2.WriteAllItems();

            Backpack2.GatherItems();
            if (Backpack2.weightMax < Backpack2.WeightCurrent)
            {
                Assert.Fail();
            }
            else
            {
                Assert.IsTrue(Backpack2.weightMax > Backpack2.WeightCurrent);
            }
        }
Exemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (plecak == null)
     {
         textBox5.Text = "Nie wygenerowano plecaka";
     }
     else
     {
         textBox5.Text = "";
         plecak.GatherItems();
         var GatherBackpack = plecak.WriteListBackpack();
         textBox5.Text += "Cała warotść :" + plecak.ValueCurrent.ToString() + System.Environment.NewLine;
         textBox5.Text += GatherBackpack;
     }
 }
Exemplo n.º 3
0
        public void TestMain()
        {
            Assert.IsNotNull(TestBackpack);
            var x = new StringWriter();

            TestBackpack.GenerateItems();
            Console.SetOut(x);
            TestBackpack.GatherItems();
            var res1 = x.ToString().Trim();
            var y    = new StringWriter();

            Console.SetOut(y);
            Zad1.Program.Main();
            var res2 = y.ToString().Trim();

            Assert.AreEqual(res1, res2);
        }