Ejemplo n.º 1
0
        private void Add(ProfileColumn column)
        {
            if (column == null)
            {
                throw new ArgumentNullException(nameof(column));
            }

            if (NameMatches(column.PropertyName))
            {
                throw ArtifactListExceptionHelper.DuplicateColumnException(column.PropertyName);
            }

            if (_columns.Count >= _maxCapacity)
            {
                throw ArtifactListExceptionHelper.ColumnCapacityExceededException(column.PropertyName, _maxCapacity);
            }

            _columns.Add(column);
        }
Ejemplo n.º 2
0
        public void Construction_DuplicateColumns_ThrowsException()
        {
            // Arrange
            var column = _columns.Last();

            _columns.Add(column);

            // Act
            try
            {
                new ProfileColumns(_columns);
            }
            catch (BadRequestException ex)
            {
                // Assert
                var expectedException = ArtifactListExceptionHelper.DuplicateColumnException(column.PropertyName);
                Assert.AreEqual(expectedException.ErrorCode, ex.ErrorCode);
                Assert.AreEqual(expectedException.Message, ex.Message);
                return;
            }

            Assert.Fail("BadRequestException was expected.");
        }