Beispiel #1
0
        public async Task Controller_DELETE_Group()
        {
            var controller = new GroupController(User, Manager);

            await PostTestGroup();

            Assert.AreEqual(3, Context.Groups.Count());
            await controller.DeleteAsync(Context.Groups.Last().Id);

            Assert.AreEqual(2, Context.Groups.Count());
            User.SetPermissions(new string[] { });
            Assert.ThrowsAsync <Shared.Exceptions.InsuficientPermission>(() => controller.DeleteAsync(0));
        }
        public async Task DeleteAsyncReturnsBadRequest()
        {
            _mockGroupService.Setup(x => x.DeleteAsync(It.IsAny <string>())).ReturnsAsync(false);
            var controller = new GroupController(_mockGroupService.Object);
            var result     = await controller.DeleteAsync("anyString").ConfigureAwait(false);

            Assert.IsType <BadRequestResult>(result);
        }