Добавлено выбрасывание исключений в SetArtilleriesGeneric
This commit is contained in:
parent
74dfc308ca
commit
eb4416e7ed
@ -26,7 +26,12 @@ namespace Artilleries
|
||||
|
||||
public int Insert(T artillery, int position)
|
||||
{
|
||||
if (position < 0 || position > Count || Count == _maxCount)
|
||||
if (Count == _maxCount)
|
||||
{
|
||||
throw new StorageOverflowException(_maxCount);
|
||||
}
|
||||
|
||||
if (position < 0 || position > Count)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -45,6 +50,11 @@ namespace Artilleries
|
||||
|
||||
var result = _places[position];
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
throw new ArtilleryNotFoundException(position);
|
||||
}
|
||||
|
||||
_places.RemoveAt(position);
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user