Example #1
0
 public async Task <IActionResult> GetOneBQ(int?id)
 {
     if (id.HasValue)
     {
         return(View(await OneBQViewModel.FromIDAsync(id.Value, _context)));
     }
     return(NoContent());
 }
Example #2
0
        public async System.Threading.Tasks.Task BehaviorIndexWorksAsync()
        {
            DbContextOptions <FunemploymentDbContext> options = new DbContextOptionsBuilder <FunemploymentDbContext>()
                                                                .UseInMemoryDatabase("BehaviorIndexRedirects")
                                                                .Options;

            using (FunemploymentDbContext context = new FunemploymentDbContext(options))
            {
                BehavioralController bc = new BehavioralController(context);

                Player player = new Player();
                player.Username = "******";
                player.Location = "testLocation";
                player.About    = "testAbout";

                var x = bc.Index();

                var y = await OneBQViewModel.FromIDAsync(1, context);

                Assert.NotEmpty(y.behaviorQuestion.Content);
                Assert.IsType <ViewResult>(x.Result);
            }
        }