Skip to content

Commit

Permalink
Address SonarCloud comments
Browse files Browse the repository at this point in the history
  • Loading branch information
davewalker5 committed Oct 23, 2023
1 parent 6f8986e commit d71da5f
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/FlightRecorder.DataExchange/AirportImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task Import(string file, FlightRecorderFactory factory)

// Inflate the CSV record to an airport and store it in the database
FlattenedAirport airport = FlattenedAirport.FromCsv(line);
Country country = await factory.Countries.AddAsync(airport.Country);
await factory.Countries.AddAsync(airport.Country);
await factory.Airports.AddAsync(airport.Code, airport.Name, airport.Country);

RecordImport?.Invoke(this, new AirportDataExchangeEventArgs { RecordCount = count - 1, Airport = airport });
Expand Down
4 changes: 2 additions & 2 deletions src/FlightRecorder.Tests/AircraftManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ public async Task FilterByManufacturerAsyncTest()
[TestMethod]
public async Task ListMissingAsyncTest()
{
IEnumerable<Aircraft> aircraft = await _factory.Aircraft.ListAsync(e => e.Registration == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, aircraft.Count());
List<Aircraft> aircraft = await _factory.Aircraft.ListAsync(e => e.Registration == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, aircraft.Count);
}

[TestMethod]
Expand Down
4 changes: 2 additions & 2 deletions src/FlightRecorder.Tests/AirlineManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public async Task FilteredListAsyncTest()
[TestMethod]
public async Task ListMissingAsyncTest()
{
IEnumerable<Airline> entities = await _factory.Airlines.ListAsync(e => e.Name == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, entities.Count());
List<Airline> entities = await _factory.Airlines.ListAsync(e => e.Name == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, entities.Count);
}
}
}
6 changes: 3 additions & 3 deletions src/FlightRecorder.Tests/AirportManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task AddDuplicateAsyncTest()
{
await _factory.Airports.AddAsync(Code, Name, Country);
var airports = await _factory.Airports.ListAsync(null, 1, 100).ToListAsync();
Assert.AreEqual(1, airports.Count());
Assert.AreEqual(1, airports.Count);
}

[TestMethod]
Expand Down Expand Up @@ -83,8 +83,8 @@ public async Task FilteredListAsyncTest()
[TestMethod]
public async Task ListMissingAsyncTest()
{
IEnumerable<Airport> airports = await _factory.Airports.ListAsync(e => e.Code == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, airports.Count());
List<Airport> airports = await _factory.Airports.ListAsync(e => e.Code == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, airports.Count);
}
}
}
6 changes: 3 additions & 3 deletions src/FlightRecorder.Tests/CountryManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void TestInitialize()
public async Task AddDuplicateAsyncTest()
{
var countries = await _factory.Countries.ListAsync(null, 1, 100).ToListAsync();
Assert.AreEqual(1, countries.Count());
Assert.AreEqual(1, countries.Count);
}

[TestMethod]
Expand Down Expand Up @@ -72,8 +72,8 @@ public async Task FilteredListAsyncTest()
[TestMethod]
public async Task ListMissingAsyncTest()
{
IEnumerable<Country> entities = await _factory.Countries.ListAsync(e => e.Name == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, entities.Count());
List<Country> entities = await _factory.Countries.ListAsync(e => e.Name == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, entities.Count);
}
}
}
8 changes: 4 additions & 4 deletions src/FlightRecorder.Tests/FlightManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public async Task AddDuplicateAsyncTest()
await _factory.Flights.AddAsync(FlightNumber, Embarkation, Destination, AirlineName);
var flights = await _factory.Flights.ListAsync(null, 1, 100).ToListAsync();
var airlines = await _factory.Airlines.ListAsync(null, 1, 100).ToListAsync();
Assert.AreEqual(1, flights.Count());
Assert.AreEqual(1, airlines.Count());
Assert.AreEqual(1, flights.Count);
Assert.AreEqual(1, airlines.Count);
}

[TestMethod]
Expand Down Expand Up @@ -84,8 +84,8 @@ public async Task FilteredListAsyncTest()
[TestMethod]
public async Task ListMissingAsyncTest()
{
IEnumerable<Flight> flights = await _factory.Flights.ListAsync(e => e.Number == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, flights.Count());
List<Flight> flights = await _factory.Flights.ListAsync(e => e.Number == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, flights.Count);
}

[TestMethod]
Expand Down
6 changes: 3 additions & 3 deletions src/FlightRecorder.Tests/LocationManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public async Task AddDuplicateAsyncTest()
{
await _factory.Locations.AddAsync(EntityName);
var locations = await _factory.Locations.ListAsync(null, 1, 100).ToListAsync();
Assert.AreEqual(1, locations.Count());
Assert.AreEqual(1, locations.Count);
}

[TestMethod]
Expand Down Expand Up @@ -70,8 +70,8 @@ public async Task FilteredListAsyncTest()
[TestMethod]
public async Task ListMissingAsyncTest()
{
IEnumerable<Location> entities = await _factory.Locations.ListAsync(e => e.Name == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, entities.Count());
List<Location> entities = await _factory.Locations.ListAsync(e => e.Name == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, entities.Count);
}
}
}
6 changes: 3 additions & 3 deletions src/FlightRecorder.Tests/ManufacturerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public async Task AddDuplicateAsyncTest()
{
await _factory.Manufacturers.AddAsync(EntityName);
var manufacturers = await _factory.Manufacturers.ListAsync(null, 1, 100).ToListAsync();
Assert.AreEqual(1, manufacturers.Count());
Assert.AreEqual(1, manufacturers.Count);
}

[TestMethod]
Expand Down Expand Up @@ -72,10 +72,10 @@ public async Task FilteredListAsyncTest()
[TestMethod]
public async Task ListMissingAsyncTest()
{
IEnumerable<Manufacturer> entities = await _factory.Manufacturers
List<Manufacturer> entities = await _factory.Manufacturers
.ListAsync(e => e.Name == "Missing", 1, 100)
.ToListAsync();
Assert.AreEqual(0, entities.Count());
Assert.AreEqual(0, entities.Count);
}
}
}
8 changes: 4 additions & 4 deletions src/FlightRecorder.Tests/ModelManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public async Task AddDuplicateAsyncTest()
await _factory.Models.AddAsync(ModelName, ManufacturerName);
var models = await _factory.Models.ListAsync(null, 1, 100).ToListAsync();
var manufacturers = await _factory.Manufacturers.ListAsync(null, 1, 100).ToListAsync();
Assert.AreEqual(1, models.Count());
Assert.AreEqual(1, manufacturers.Count());
Assert.AreEqual(1, models.Count);
Assert.AreEqual(1, manufacturers.Count);
}

[TestMethod]
Expand Down Expand Up @@ -81,8 +81,8 @@ public async Task FilteredListAsyncTest()
[TestMethod]
public async Task ListMissingAsyncTest()
{
IEnumerable<Model> models = await _factory.Models.ListAsync(e => e.Name == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, models.Count());
List<Model> models = await _factory.Models.ListAsync(e => e.Name == "Missing", 1, 100).ToListAsync();
Assert.AreEqual(0, models.Count);
}

[TestMethod]
Expand Down
10 changes: 5 additions & 5 deletions src/FlightRecorder.Tests/SightingManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public async Task ListByAircraftAsyncTest()
public async Task ListByAircraftWithNoSightingsAsyncTest()
{
await _factory.Aircraft.AddAsync("G-EZEH", "2184", 2004, ModelName, ManufacturerName);
IEnumerable<Sighting> sightings = await _factory.Sightings.ListByAircraftAsync("G-EZEH", 1, 100).Result.ToListAsync();
Assert.AreEqual(0, sightings.Count());
List<Sighting> sightings = await _factory.Sightings.ListByAircraftAsync("G-EZEH", 1, 100).Result.ToListAsync();
Assert.AreEqual(0, sightings.Count);
}

[TestMethod]
Expand All @@ -138,8 +138,8 @@ public async Task ListByRouteAsyncTest()
public async Task ListByRouteWithNoSightingsAsyncTest()
{
await _factory.Flights.AddAsync("BA92", "YYZ", "LHR", "British Airways");
IEnumerable <Sighting> sightings = await _factory.Sightings.ListByRouteAsync("YYZ", "LHR", 1, 100).Result.ToListAsync();
Assert.AreEqual(0, sightings.Count());
List<Sighting> sightings = await _factory.Sightings.ListByRouteAsync("YYZ", "LHR", 1, 100).Result.ToListAsync();
Assert.AreEqual(0, sightings.Count);
}

[TestMethod]
Expand Down Expand Up @@ -182,7 +182,7 @@ public async Task ListByLocationAsyncTest()
IAsyncEnumerable<Sighting> matches = await _factory.Sightings
.ListByLocationAsync(LocationName, 1, 100);
List<Sighting> sightings = await matches.ToListAsync();
Assert.AreEqual(1, sightings.Count());
Assert.AreEqual(1, sightings.Count);
Assert.AreEqual(_sightingId, sightings.First().Id);
}

Expand Down

0 comments on commit d71da5f

Please sign in to comment.