コード例 #1
0
        public void TheUpdateMethodIsCalledCorrectly()
        {
            _updateMethod = (columnId, y, session) => { if (columnId == ColumnId && session == _session) throw new MethodAccessException(); };

            _methodGroup = new UpdateColumnDescriptionMethodGroup(_columnExists, _updateMethod, _sessionMethod);
            AssertionExtensions.ShouldThrow<MethodAccessException>(() => _columnControllerShadow.UpdateColumnDescription(ColumnId, Description, _methodGroup));
        }
コード例 #2
0
        public void TheColumnDoesNotExistSoAnExceptionIsThrown()
        {
            _columnExists = (x, session) => false;
            _methodGroup = new UpdateColumnDescriptionMethodGroup(_columnExists, _updateMethod, _sessionMethod);

            AssertionExtensions.ShouldThrow<ArgumentException>(() => _columnControllerShadow.UpdateColumnDescription(ColumnId, Description, _methodGroup));
        }
コード例 #3
0
        public JsonResult UpdateColumnDescription(int columnId, string description, UpdateColumnDescriptionMethodGroup methodGroup)
        {
            new WithSession(methodGroup.SessionMethod)
                .Do(session =>
                    {
                        GuardClause.IfFalseThenThrowArgumentException(() => methodGroup.ColumnExists(columnId, session), "ColumnControllerShadow.UpdateColumnDescription: column doesn't exist.");
                        methodGroup.UpdateMethod(columnId, description, session);
                    });

            return new JsonResult { Data = description };
        }
コード例 #4
0
 public void TheUpdatedIsMadeAndTheTextIsReturned()
 {
     _methodGroup = new UpdateColumnDescriptionMethodGroup(_columnExists, _updateMethod, _sessionMethod);
     _columnControllerShadow.UpdateColumnDescription(ColumnId, Description, _methodGroup).Data.Should().Be(Description);
 }
コード例 #5
0
 public void AndTheColumnQueryIsCalledCorrectly()
 {
     _columnExists = (id, session) => { if (id == ColumnId && session == _session) throw new MethodAccessException(); return false; };
     _methodGroup = new UpdateColumnDescriptionMethodGroup(_columnExists, _updateMethod, _sessionMethod);
 }
コード例 #6
0
 public void AndANewSessionIsCreated()
 {
     _methodGroup = new UpdateColumnDescriptionMethodGroup(_columnExists, _updateMethod, () => { throw new MethodAccessException(); });
     AssertionExtensions.ShouldThrow<MethodAccessException>(() => _columnControllerShadow.UpdateColumnDescription(ColumnId, Description, _methodGroup));
 }