Beispiel #1
0
        public void V1_通過驗證且不是Admin角色()
        {
            var    calculation = InjectionFactory.Create();
            Action action      = () => { calculation.Execute(1, 1); };

            action.ShouldThrow <Exception>().WithMessage("*Admin*");
        }
Beispiel #2
0
        public void GivenCreatedObject_WhenDestroyed_ReleasesInContainer()
        {
            var item = _sut.Create();

            _sut.Destroy(item);

            _container.ReceivedWithAnyArgs(1).Release(Arg.Any <object>());
        }
Beispiel #3
0
        public void V1_通過驗證且是Admin角色_調用Execute_預期得到例外()
        {
            Thread.CurrentPrincipal =
                new GenericPrincipal(new GenericIdentity("Administrator"),
                                     new[] { "Admin" });
            var    calculation = InjectionFactory.Create();
            Action action      = () => { calculation.Execute(1, 1); };

            action.ShouldThrow <Exception>().WithMessage("*喔喔*");
        }