コード例 #1
0
        public void Find_ReturnsCorrectArrivalFromDatabase_Arrival()
        {
            //Arrange
            Arrival testArrival = new Arrival("Mow the lawn");

            testArrival.Save();

            //Act
            Arrival foundArrival = Arrival.Find(testArrival.Id);

            //Assert
            Assert.AreEqual(testArrival, foundArrival);
        }
コード例 #2
0
        public void Save_SavesToDatabase_ArrivalList()
        {
            //Arrange
            Arrival testArrival = new Arrival("Mow the lawn");

            //Act
            testArrival.Save();
            List <Arrival> result   = Arrival.GetAll();
            List <Arrival> testList = new List <Arrival> {
                testArrival
            };

            //Assert
            CollectionAssert.AreEqual(testList, result);
        }
コード例 #3
0
        public void Save_AssignsIdToObject_Id()
        {
            //Arrange
            Arrival testArrival = new Arrival("Mow the lawn");

            //Act
            testArrival.Save();
            Arrival savedArrival = Arrival.GetAll()[0];

            int result = savedArrival.Id;
            int testId = testArrival.Id;

            //Assert
            Assert.AreEqual(testId, result);
        }
コード例 #4
0
        public void GetAll_ReturnsArrivals_ArrivalList()
        {
            //Arrange
            string  city01      = "Walk the dog";
            string  city02      = "Wash the dishes";
            Arrival newArrival1 = new Arrival(city01);

            newArrival1.Save();
            Arrival newArrival2 = new Arrival(city02);

            newArrival2.Save();
            List <Arrival> newList = new List <Arrival> {
                newArrival1, newArrival2
            };

            //Act
            List <Arrival> result = Arrival.GetAll();

            //Assert
            CollectionAssert.AreEqual(newList, result);
        }