Skip to content

Conversation

@Al3xramirez
Copy link

@Al3xramirez Al3xramirez commented Nov 17, 2025

Worked with @thigiang16. Implemented Extra credit on branch #89

Copilot AI review requested due to automatic review settings November 17, 2025 19:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements LINQ-based functionality for assignments 7 and 8, including CSV file parsing, data manipulation, and a custom circular linked list implementation with enumerable support.

Key Changes:

  • Implemented CSV file reading and parsing with LINQ operations to extract and process person data
  • Created a generic circular linked list (Node<T>) with full IEnumerable<T> support
  • Added comprehensive test coverage for both the SampleData and Node implementations

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
Assignment/Directory.Build.targets Added build targets configuration to include project references for Assignment and Assignment.Tests projects
Assignment/Assignment/SampleData.cs Implemented all ISampleData interface methods using LINQ for CSV parsing, state aggregation, and people filtering
Assignment/Assignment/Node.cs Implemented a generic circular linked list with enumerable support, including append, clear, exists, and child item methods
Assignment/Assignment/Assignment.csproj Added configuration to copy People.csv file to output directory
Assignment/Assignment.sln Fixed VisualStudioVersion string and added Directory.Build.targets to solution items
Assignment/Assignment.Tests/SampleDataTests.cs Added comprehensive test coverage for all SampleData methods with various edge cases
Assignment/Assignment.Tests/NodeTests.cs Added test coverage for Node class functionality including enumeration, LINQ queries, and circular list operations
Assignment/Assignment.Tests/Assignment.Tests.csproj Updated MSTest packages to version 4.0.2 and added project reference to Assignment project

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@steeley21 steeley21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instructions

Throughout, consider using the System.Linq.Enumerable methods Zip, Count, Sort and Contains methods for testing collections.. (Preferably avoid using Microsoft.VisualStudio.TestTools.UnitTesting.CollectionAssert although that might be easier, to get a firmer grasp on additional LINQ API.)

Implement the ISampleData.CsvRows property, loading the data from the People.csv file and returning each line as a single string. ✔
Change the "Copy to" property on People.csv to "Copy if newer" so that the file is deployed along with your test project. ✔
Using LINQ, skip the first row in the People.csv. ✔
Be sure to appropriately handle resource (IDisposable) items correctly if applicable (and it may not be depending on how you implement it). ✔

Implement IEnumerable GetUniqueSortedListOfStatesGivenCsvRows() to return a sorted, unique list of states. ✔
Use ISampleData.CsvRows for your data source. ✔
Don't forget the list should be unique. ✔
Sort the list alphabetically. ✔
Include a test that leverages a hardcoded list of addresses. ✔
Include a test that uses LINQ to verify the data is sorted correctly (do not use a hardcoded list). ✔

Implement ISampleData.GetAggregateSortedListOfStatesUsingCsvRows() to return a string that contains a unique, comma separated list of states. ✔
Use ISampleData.GetUniqueSortedListOfStatesGivenCsvRows() for your data source. ✔
Consider "selecting" only the states and calling ToArray() to retrieve an array of all the state names. ✔
Given the array, consider using string.Join to combine the list into a single string. ✔

Implement the ISampleData.People property to return all the items in People.csv as Person objects ✔
Use ISampleData.CsvRows as the source of the data. ✔
Sort the list by State, City, and Zip. ✔
Be sure that Person.Address is also populated. ✔
Adding null validation to all the Person and Address properties is optional.
Consider using ISampleData.CsvRows in your test to verify your results. ✔

Implement ISampleDate.FilterByEmailAddress(Predicate filter) to return a list of names where the email address matches the filter. ✔
Use ISampleData.People for your data source. ✔

Implement ISampleData.GetAggregateListOfStatesGivenPeopleCollection(IEnumerable people) to return a string that contains a unique, comma-separated list of states. ✔
Use the people parameter from ISampleData.People property for your data source. ✔
At a minimum, use the System.Linq.Enumerable.Aggregate` LINQ method to create your result. ✔
Don't forget the list should be unique. ✔
It is recommended that, at a minimum, you use ISampleData.GetUniqueSortedListOfStatesGivenCsvRows to validate your result.

Given the implementation of Node in Assignment5

Implement IEnumerable to return all the items in the "circle" of items. ✔
Add an IEnumberable ChildItems(int maximum) method to Node that returns the remaining items with a maximum number of items returned less than maximum.

Extra Credit

Implement the homework using async/await and multi-threading by defining a new SampleDataAsync class that implements IAsyncSampleData). Refactor your SampleData and SampleDataAsync classes with minimal duplication. Be sure to refactor your tests to re-use a significant amount of the test code for both implementations. ✔

Fundamentals

Place all shared project properties into a Directory.Build.Props file.
Place all shared project items into a Directory.Build.targets file.
Ensure nullable reference types is enabled ✔
Ensure that you turn on code analysis for all projects(EnableNETAnalyzers) ✔
Set LangVersion and the TargetFramework to the latest released versions available (preview versions optional) ✔
and enabled .NET analyzers for both projects ✔
For this assignment, consider using Assert.AreEqual() (the generic version) ✔
All of the above should be unit tested ✔
Choose simplicity over complexity ✔

Nice work guys!

Copy link

@ulises-aguilar ulises-aguilar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implement the ISampleData.CsvRows property, loading the data from the People.csv file and returning each line as a single string. ✔

Change the "Copy to" property on People.csv to "Copy if newer" so that the file is deployed along with your test project. ✔
Using LINQ, skip the first row in the People.csv. ✔
Be sure to appropriately handle resource (IDisposable) items correctly if applicable (and it may not be depending on how you implement it). ✔
Implement IEnumerable GetUniqueSortedListOfStatesGivenCsvRows() to return a sorted, unique list of states. ✔

Use ISampleData.CsvRows for your data source. ✔
Don't forget the list should be unique. ✔
Sort the list alphabetically. ✔
Include a test that leverages a hardcoded list of addresses. ✔
Include a test that uses LINQ to verify the data is sorted correctly (do not use a hardcoded list). ✔
Implement ISampleData.GetAggregateSortedListOfStatesUsingCsvRows() to return a string that contains a unique, comma separated list of states. ✔

Use ISampleData.GetUniqueSortedListOfStatesGivenCsvRows() for your data source. ✔
Consider "selecting" only the states and calling ToArray() to retrieve an array of all the state names. ✔
Given the array, consider using string.Join to combine the list into a single string. ✔
Implement the ISampleData.People property to return all the items in People.csv as Person objects ✔

Use ISampleData.CsvRows as the source of the data. ✔
Sort the list by State, City, and Zip. ✔
Be sure that Person.Address is also populated. ✔
Adding null validation to all the Person and Address properties is optional.
Consider using ISampleData.CsvRows in your test to verify your results. ✔
Implement ISampleDate.FilterByEmailAddress(Predicate filter) to return a list of names where the email address matches the filter. ✔

Use ISampleData.People for your data source. ✔
Implement ISampleData.GetAggregateListOfStatesGivenPeopleCollection(IEnumerable people) to return a string that contains a unique, comma-separated list of states. ✔

Use the people parameter from ISampleData.People property for your data source. ✔
At a minimum, use the System.Linq.Enumerable.Aggregate` LINQ method to create your result. ✔
Don't forget the list should be unique. ✔
It is recommended that, at a minimum, you use ISampleData.GetUniqueSortedListOfStatesGivenCsvRows to validate your result.
Given the implementation of Node in Assignment5

Implement IEnumerable to return all the items in the "circle" of items. ✔
Add an IEnumberable ChildItems(int maximum) method to Node that returns the remaining items with a maximum number of items returned less than maximum.

@github-actions
Copy link

Summary

Summary
Generated on: 11/20/2025 - 20:31:46
Coverage date: 11/20/2025 - 20:31:44
Parser: MultiReport (2x Cobertura)
Assemblies: 1
Classes: 4
Files: 4
Line coverage: 93.6% (148 of 158)
Covered lines: 148
Uncovered lines: 10
Coverable lines: 158
Total lines: 246
Branch coverage: 71.8% (23 of 32)
Covered branches: 23
Total branches: 32
Method coverage: Feature is only available for sponsors
Tag: 471_19550464584

Coverage

Assignment - 93.6%
Name Line Branch
Assignment 93.6% 71.8%
Assignment.Address 100%
Assignment.Node`1 90.1% 72.7%
Assignment.Person 100%
Assignment.SampleData 94.6% 70%

Copy link
Collaborator

@Joshua-Lester3 Joshua-Lester3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instructions

Throughout, consider using the System.Linq.Enumerable methods Zip, Count, Sort and Contains methods for testing collections.. (Preferably avoid using Microsoft.VisualStudio.TestTools.UnitTesting.CollectionAssert although that might be easier, to get a firmer grasp on additional LINQ API.)

  1. Implement the ISampleData.CsvRows property, loading the data from the People.csv file and returning each line as a single string. ✔

    • Change the "Copy to" property on People.csv to "Copy if newer" so that the file is deployed along with your test project. ✔
    • Using LINQ, skip the first row in the People.csv. ✔
    • Be sure to appropriately handle resource (IDisposable) items correctly if applicable (and it may not be depending on how you implement it). ✔
  2. Implement IEnumerable<string> GetUniqueSortedListOfStatesGivenCsvRows() to return a sorted, unique list of states. ✔

    • Use ISampleData.CsvRows for your data source. ✔
    • Don't forget the list should be unique. ✔
    • Sort the list alphabetically. ✔
    • Include a test that leverages a hardcoded list of addresses. ❌ didn't test implementation
    • Include a test that uses LINQ to verify the data is sorted correctly (do not use a hardcoded list). ❌ ^ same
  3. Implement ISampleData.GetAggregateSortedListOfStatesUsingCsvRows() to return a string that contains a unique, comma separated list of states. ✔

    • Use ISampleData.GetUniqueSortedListOfStatesGivenCsvRows() for your data source. ✔
    • Consider "selecting" only the states and calling ToArray() to retrieve an array of all the state names. ✔
    • Given the array, consider using string.Join to combine the list into a single string. ✔
  4. Implement the ISampleData.People property to return all the items in People.csv as Person objects ✔

    • Use ISampleData.CsvRows as the source of the data. ✔
    • Sort the list by State, City, and Zip. ✔
    • Be sure that Person.Address is also populated. ✔
    • Adding null validation to all the Person and Address properties is optional.
    • Consider using ISampleData.CsvRows in your test to verify your results. ✔
  5. Implement ISampleDate.FilterByEmailAddress(Predicate<string> filter) to return a list of names where the email address matches the filter. ✔

    • Use ISampleData.People for your data source. ✔
  6. Implement ISampleData.GetAggregateListOfStatesGivenPeopleCollection(IEnumerable<IPerson> people) to return a string that contains a unique, comma-separated list of states. ✔

    • Use the people parameter from ISampleData.People property for your data source. ✔
    • At a minimum, use the System.Linq.Enumerable.Aggregate` LINQ method to create your result. ✔
    • Don't forget the list should be unique. ✔
    • It is recommended that, at a minimum, you use ISampleData.GetUniqueSortedListOfStatesGivenCsvRows to validate your result.
  7. Given the implementation of Node in Assignment5

  • Implement IEnumerable<T> to return all the items in the "circle" of items. ✔
  • Add an IEnumberable<T> ChildItems(int maximum) method to Node that returns the remaining items with a maximum number of items returned less than maximum.

Extra Credit

  • Implement the homework using async/await and multi-threading by defining a new SampleDataAsync class that implements IAsyncSampleData). Refactor your SampleData and SampleDataAsync classes with minimal duplication. Be sure to refactor your tests to re-use a significant amount of the test code for both implementations. ❌✔ in other branch

Fundamentals

  • Place all shared project properties into a Directory.Build.Props file.
  • Place all shared project items into a Directory.Build.targets file.
  • Ensure nullable reference types is enabled ✔
  • Ensure that you turn on code analysis for all projects(EnableNETAnalyzers) ✔
  • Set LangVersion and the TargetFramework to the latest released versions available (preview versions optional) ✔
  • and enabled .NET analyzers for both projects ✔
  • For this assignment, consider using Assert.AreEqual<T>() (the generic version) ✔
  • All of the above should be unit tested ✔
  • Choose simplicity over complexity ✔

Comment on lines +51 to +68
var actualStates = rows
.Select(row =>
{
var parts = row.Split(',');
return parts.Length > 6 ? parts[6].Trim() : string.Empty;
})
.Where(state => !string.IsNullOrWhiteSpace(state))
.Distinct()
.OrderBy(state => state)
.ToList();

var expectedStates = new[]
{
"CA","FL","NY","WA"
};

//use collections assert to compare two collections instead of Assert.AreEqual
CollectionAssert.AreEqual(expectedStates, actualStates);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't referencing SampleData at all - you're not testing your implementation.

Comment on lines +55 to +58
.Where(row => row.Split(',').Length >= 8)
.Select(row =>
{
string[] parts = row.Split(',');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if my solution would be best practice - seems a little messy, but you could do a select before the where to split it, return the array, then filter using where, then continue with the following code.


return person;
})
.OfType<IPerson>() // tell compiler that after filtering, it's safe
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants