public async Task TestCase_GetList(String usr) { var context = fixture.GetCurrentDataContext(); fixture.InitializeTestData(); var control = new AwardUsersController(context); try { control.Get(); } catch (Exception ex) { Assert.NotNull(ex); } if (!String.IsNullOrEmpty(usr)) { var userclaim = DataSetupUtility.GetClaimForUser(usr); control.ControllerContext = new ControllerContext() { HttpContext = new DefaultHttpContext() { User = userclaim } }; var getrst = control.Get(); Assert.NotNull(getrst); if (usr == DataSetupUtility.UserA) { Assert.Equal(1, getrst.Count()); } else if (usr == DataSetupUtility.UserB) { Assert.Equal(0, getrst.Count()); } } await context.DisposeAsync(); }
public async Task TestCase_GetList(String usr) { var context = fixture.GetCurrentDataContext(); fixture.InitializeTestData(); var control = new InvitedUsersController(context); try { control.Get(); } catch (Exception ex) { Assert.IsType <UnauthorizedAccessException>(ex); } if (!String.IsNullOrEmpty(usr)) { var userclaim = DataSetupUtility.GetClaimForUser(usr); control.ControllerContext = new ControllerContext() { HttpContext = new DefaultHttpContext() { User = userclaim } }; var getrst = control.Get(); Assert.NotNull(getrst); // Why just retun the useritself? Assert.Equal(1, getrst.Count()); } await context.DisposeAsync(); }