Example #1
0
        public static void Setup(TestContext testContext)
        {
            //Clean up possible junk in DB to set up the test
            users.DeleteUser(users.GetUserNullable(author)?.Id);
            users.DeleteUser(users.GetUserNullable(reservingUser)?.Id);
            users.DeleteUser(users.GetUserNullable(thirdUser)?.Id);

            users.RegisterUser("Reserve Unit Tester", author, "http://test.com/image.jpg", pass);
            users.RegisterUser("Reserve Unit Tester", reservingUser, "http://test.com/image.jpg", pass);
            users.RegisterUser("Reserve Unit Tester", thirdUser, "http://test.com/image.jpg", pass);

            //Create one more ad than needed for testing
            for (int i = 0; i < maxReservations + 1; i++)
            {
                toReserve[i] = ads.PostAd(author, "Unit Test - Reserve", "Reserve me.", "Aalborg", AdType.Selling);
            }
        }
Example #2
0
        public void TestPostAd()
        {
            var author = "*****@*****.**";
            Ad  ad     = control.PostAd(author, "Unit Test", "This ad was written by a unit test.", "Aalborg");

            Assert.IsTrue(control.GetAd(ad.Id)?.Id == ad.Id);
            control.DeleteAd(ad.Id, author);
        }