Example #1
0
        public async Task Controller_DELETE()
        {
            var controller = new TypeController(Manager, User);

            var mdl = await controller.PostAsync(new TypeCreate()
            {
                Name = "test"
            }) as JsonResult;

            var obj = mdl.Value as Models.Output.Symbols.Type;

            Assert.AreEqual(1, obj.Id);
            Assert.AreEqual("test", obj.Name);
            Assert.AreEqual(1, Context.SymbolTypes.Count());

            await controller.DeleteAsync(1);

            Assert.AreEqual(0, Context.SymbolTypes.Count());

            User.SetPermissions(new string[] { });
            Assert.ThrowsAsync <Shared.Exceptions.InsuficientPermission>(() => controller.DeleteAsync(1));
        }