public async Task EditTest() { // first no user logged LogOut(); IActionResult res = await controller.Item("NOTEXIST", null); Assert.IsInstanceOf <NotFoundResult>(res); res = await controller.Edit("DOC", null); Assert.IsInstanceOf <ForbidResult>(res); res = await controller.Edit("TEST"); Assert.IsInstanceOf <ForbidResult>(res); res = await controller.Edit("CLOSED"); Assert.IsInstanceOf <ForbidResult>(res); res = await controller.Edit("PRIV"); Assert.IsInstanceOf <ForbidResult>(res); // user logged as admin LogIn(Admin); res = await controller.Edit("DOC"); Assert.IsInstanceOf <ViewResult>(res); res = await controller.Edit("TEST"); Assert.IsInstanceOf <ViewResult>(res); res = await controller.Edit("CLOSED"); Assert.IsInstanceOf <ViewResult>(res); res = await controller.Edit("PRIV"); Assert.IsInstanceOf <ViewResult>(res); // user logged as 2 LogIn(users[1]); res = await controller.Edit("DOC"); Assert.IsInstanceOf <ViewResult>(res); res = await controller.Edit("TEST"); Assert.IsInstanceOf <ViewResult>(res); res = await controller.Edit("CLOSED"); Assert.IsInstanceOf <ForbidResult>(res); res = await controller.Edit("PRIV"); Assert.IsInstanceOf <ViewResult>(res); // user logged as 2 LogIn(users[2]); res = await controller.Edit("DOC"); Assert.IsInstanceOf <ForbidResult>(res); res = await controller.Edit("TEST"); Assert.IsInstanceOf <ForbidResult>(res); res = await controller.Edit("CLOSED"); Assert.IsInstanceOf <ViewResult>(res); res = await controller.Edit("PRIV"); Assert.IsInstanceOf <ForbidResult>(res); res = await controller.Edit("DOC", null); Assert.IsInstanceOf <ForbidResult>(res); res = await controller.Edit("TEST", null); Assert.IsInstanceOf <ForbidResult>(res); res = await controller.Edit("CLOSED", null); Assert.IsInstanceOf <ViewResult>(res, null); res = await controller.Edit("PRIV"); Assert.IsInstanceOf <ForbidResult>(res, null); }