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)); }
public void TheColumnDoesNotExistSoAnExceptionIsThrown() { _columnExists = (x, session) => false; _methodGroup = new UpdateColumnDescriptionMethodGroup(_columnExists, _updateMethod, _sessionMethod); AssertionExtensions.ShouldThrow<ArgumentException>(() => _columnControllerShadow.UpdateColumnDescription(ColumnId, Description, _methodGroup)); }
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 }; }
public void TheUpdatedIsMadeAndTheTextIsReturned() { _methodGroup = new UpdateColumnDescriptionMethodGroup(_columnExists, _updateMethod, _sessionMethod); _columnControllerShadow.UpdateColumnDescription(ColumnId, Description, _methodGroup).Data.Should().Be(Description); }
public void AndTheColumnQueryIsCalledCorrectly() { _columnExists = (id, session) => { if (id == ColumnId && session == _session) throw new MethodAccessException(); return false; }; _methodGroup = new UpdateColumnDescriptionMethodGroup(_columnExists, _updateMethod, _sessionMethod); }
public void AndANewSessionIsCreated() { _methodGroup = new UpdateColumnDescriptionMethodGroup(_columnExists, _updateMethod, () => { throw new MethodAccessException(); }); AssertionExtensions.ShouldThrow<MethodAccessException>(() => _columnControllerShadow.UpdateColumnDescription(ColumnId, Description, _methodGroup)); }