コード例 #1
0
ファイル: UserGroupsTests.cs プロジェクト: rocketeerbkw/DNA
        public void DeleteGroup_ThrowsException()
        {
            
            var groupName = "editor";

            var cache = GetGroupsCache(_mocks);

            var reader = _mocks.DynamicMock<IDnaDataReader>();
            var creator = _mocks.DynamicMock<IDnaDataReaderCreator>();
            creator.Stub(x => x.CreateDnaDataReader("createnewusergroup")).Return(reader);
            var diag = _mocks.DynamicMock<IDnaDiagnostics>();
            _mocks.ReplayAll();

            var obj = new UserGroups(creator, diag, cache, null, null);

            bool exceptionThrown = false;
            try
            {

                obj.DeleteGroup(groupName);
            }
            catch (NotSupportedException e)
            {
                exceptionThrown = true;
                Assert.AreEqual("We do not delete groups at this time!", e.Message);
            }
            Assert.IsTrue(exceptionThrown);
        }