Beispiel #1
0
      public void TestSemiUnLoadProductUnloadsTheCorretItem()
      {
          Vehicle semi = new Semi();

          Product hardDrive = new HardDrive(120);

          semi.LoadProduct(new Gpu(100));
          semi.LoadProduct(hardDrive);
          Assert.AreEqual(semi.Unload(), hardDrive);
      }
Beispiel #2
0
      public void TestSemiPropertyIsFullReturnsCorrectValueWhenFull()
      {
          Vehicle semi      = new Semi();
          Product hardDrive = new HardDrive(120);

          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          Assert.True(semi.IsFull, "Semi should be full");
      }
Beispiel #3
0
      public void TestSemiPropertyIsFullReturnsCorrectValueWhenNotFull()
      {
          Vehicle semi      = new Semi();
          Product hardDrive = new HardDrive(120);

          semi.LoadProduct(new Gpu(100));
          Assert.False(semi.IsFull, "Semi should not be full");
      }
Beispiel #4
0
      public void TestSemiPropertyIsEmptyReturnsCorrectValueWhenNotEmpty()
      {
          Vehicle semi      = new Semi();
          Product hardDrive = new HardDrive(120);

          semi.LoadProduct(new Gpu(100));
          Assert.IsFalse(semi.IsEmpty, "Semi should not be empty");
      }
Beispiel #5
0
        public void TestLoadProduct()
        {
            Vehicle vehicle = new Semi();

            vehicle.LoadProduct(new Gpu(5));

            Assert.AreEqual(1, vehicle.Trunk.Count);
        }
Beispiel #6
0
      public void TestSemiUnLoadProductThrowsExceptionWhenEmpty()
      {
          Vehicle semi      = new Semi();
          Product hardDrive = new HardDrive(120);

          semi.LoadProduct(new Gpu(100));
          semi.Unload();
          Assert.Throws <InvalidOperationException>(() => semi.Unload(), "Empty Semi still unloads products.");
      }
Beispiel #7
0
      public void TestSemiLoadProductLoadsItems()
      {
          Vehicle semi = new Semi();

          Product gpu = new Gpu(120);

          semi.LoadProduct(gpu);

          Assert.AreEqual(semi.Trunk.First(), gpu, "Semi does not add products correctly.");
      }
Beispiel #8
0
      public void TestSemiTrunkReturnsCorrectCollection()
      {
          Vehicle        semi      = new Semi();
          Product        hardDrive = new HardDrive(120);
          Product        gpu       = new Gpu(100);
          Product        ram       = new Ram(40);
          List <Product> products  = new List <Product>()
          {
              hardDrive,
              gpu,
              ram,
          };

          semi.LoadProduct(hardDrive);
          semi.LoadProduct(gpu);
          semi.LoadProduct(ram);

          CollectionAssert.AreEqual(semi.Trunk, products, "Added items should be the same.");
      }
Beispiel #9
0
      public void TestSemiLoadProductThrowsExceptionWhenFull()
      {
          Vehicle semi = new Semi();

          Product hardDrive = new HardDrive(120);

          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          semi.LoadProduct(hardDrive);
          Assert.Throws <InvalidOperationException>(() => semi.LoadProduct(hardDrive), "Full Semi does not throw exception.");
      }