Fix fix 2
This commit is contained in:
parent
e8a4f802de
commit
d83fc2dc2b
@ -30,7 +30,7 @@ namespace GasolineTanker
|
|||||||
{
|
{
|
||||||
var configuration = new ConfigurationBuilder()
|
var configuration = new ConfigurationBuilder()
|
||||||
.SetBasePath(Directory.GetCurrentDirectory())
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
.AddJsonFile(path: "C:\\Users\\kashi\\Desktop\\RPP\\GasolineTankerBase\\Base\\GasolineTanker\\GasolineTanker\\appSetting.json", optional: false, reloadOnChange: true)
|
.AddJsonFile(path: "C:\\Users\\kashi\\Desktop\\RPP\\GasolineTanker\\GasolineTanker\\GasolineTanker\\appSetting.json", optional: false, reloadOnChange: true)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
var logger = new LoggerConfiguration()
|
var logger = new LoggerConfiguration()
|
||||||
|
@ -27,15 +27,17 @@ namespace GasolineTanker
|
|||||||
}
|
}
|
||||||
public int Insert(T gasolineTanker, int position)
|
public int Insert(T gasolineTanker, int position)
|
||||||
{
|
{
|
||||||
if (_places.Contains(gasolineTanker))
|
|
||||||
throw new ArgumentException($"The {gasolineTanker} object is already in the set");
|
|
||||||
if (Count == _maxCount)
|
if (Count == _maxCount)
|
||||||
throw new StorageOverflowException(_maxCount);
|
throw new StorageOverflowException(_maxCount);
|
||||||
if (!isCorrectPosition(position))
|
|
||||||
{
|
if (position < 0 || position > Count)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
if (_places.Contains(gasolineTanker))
|
||||||
|
return -1;
|
||||||
|
|
||||||
_places.Insert(position, gasolineTanker);
|
_places.Insert(position, gasolineTanker);
|
||||||
|
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
public T Remove(int position)
|
public T Remove(int position)
|
||||||
|
Loading…
Reference in New Issue
Block a user