Example #1
0
        public async Task ApartmentsOwnedLoggedIn()
        {
            var context = new POAMDbContext();

            RemoveUser(context);

            Authentication.Instance.UserLogin(CreateUser(context));

            var apartmentController = new ApartmentController(context);

            var result = await apartmentController.ApartmentsOwned();


            var redirectResult = Assert.IsType <ViewResult>(result);

            Assert.NotNull(redirectResult);
            Assert.True(string.IsNullOrEmpty(redirectResult.ViewName) || redirectResult.ViewName == "ApartmentsOwned");
            var model = Assert.IsAssignableFrom <IEnumerable <Apartment> >(redirectResult.ViewData.Model);

            Authentication.Instance.Logout();
            RemoveUser(context);
        }