Ejemplo n.º 1
0
        public void Test5_AddPirateToShip()
        {
            Ship testShip = new Ship("Black Pearl", "long");

            testShip.Save();

            Pirate testPirate1 = new Pirate("Jack Sparow", "Captain");

            testPirate1.Save();

            Pirate testPirate2 = new Pirate("Jones", "Captain");

            testPirate2.Save();


            testShip.AddPirate(testPirate1);
            testShip.AddPirate(testPirate2);

            List <Pirate> result   = testShip.GetPirate();
            List <Pirate> testList = new List <Pirate> {
                testPirate1, testPirate2
            };


            Assert.Equal(testList, result);
        }
Ejemplo n.º 2
0
        public void Test3_UpdatePirateName()
        {
            Pirate newPirate = new Pirate("pearl", "long");

            newPirate.Save();
            newPirate.Update("sage");
            string result = newPirate.GetName();

            Assert.Equal("sage", result);
        }
Ejemplo n.º 3
0
        public void Test7_FindPirate()
        {
            Pirate testPirate = new Pirate("ayaya", "cap");

            testPirate.Save();

            Pirate foundPirate = Pirate.Find(testPirate.GetId());

            Assert.Equal(testPirate, foundPirate);
        }
Ejemplo n.º 4
0
        public void Test3_SavePirate()
        {
            //Arrange
            Pirate testPirate = new Pirate("Joe", "Cap");

            testPirate.Save();

            //Act
            List <Pirate> result   = Pirate.GetAll();
            List <Pirate> testList = new List <Pirate> {
                testPirate
            };

            //Assert
            Assert.Equal(testList, result);
        }
Ejemplo n.º 5
0
        public void Test4_DeleteOnePirate()
        {
            Pirate firstPirate = new Pirate("sage", "long");

            firstPirate.Save();

            Pirate secondPirate = new Pirate("blue", "short");

            secondPirate.Save();

            firstPirate.Delete();
            List <Pirate> allPirate = Pirate.GetAll();
            List <Pirate> afterDeleteFirstPirate = new List <Pirate> {
                secondPirate
            };

            Assert.Equal(afterDeleteFirstPirate, allPirate);
        }
Ejemplo n.º 6
0
        public void Test5_AddShipToPirate()
        {
            Pirate testPirate = new Pirate("ayaya", "cap");

            testPirate.Save();

            Ship testShip = new Ship("grr", "small");

            testShip.Save();

            testPirate.AddShip(testShip);

            List <Ship> result   = testPirate.GetShips();
            List <Ship> testList = new List <Ship> {
                testShip
            };

            Assert.Equal(testList, result);
        }
Ejemplo n.º 7
0
        public void Test6_ReturnPiratesOnShip()
        {
            Pirate testPirate = new Pirate("ayaya", "cap");

            testPirate.Save();

            Ship testShip1 = new Ship("black", "long");

            testShip1.Save();

            Ship testShip2 = new Ship("white", "short");

            testShip2.Save();

            testPirate.AddShip(testShip1);
            List <Ship> result   = testPirate.GetShips();
            List <Ship> testList = new List <Ship> {
                testShip1
            };

            Assert.Equal(testList, result);
        }