You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -124,56 +124,14 @@ Use the following steps to complete this section of the exercise:
124
124
125
125
To see a list of all available chat participants, type**@**in the chat prompt box.
126
126
127
-
1. Take a few minutes to compare GitHub Copilot's response with the actual project files.
127
+
1. Take a minute to compare GitHub Copilot's response with the actual project files.
128
128
129
-
You should see a response that's similar to the following description:
129
+
You should see a response that describes each of the projects in the solution:
130
130
131
-
```markdown
132
-
133
-
This project is a .NET solution named AccelerateDevGHCopilot that appears to be a library and application framework with a modular structure. It is organized into three main components under the *src* directory and a unit testing project under the *tests* directory. Here's a breakdown:
134
-
135
-
**Solution Structure**
136
-
137
-
- Solution File: AccelerateDevGHCopilot.sln
138
-
139
-
- Contains references to the projects in the solution.
140
-
141
-
**Projects**
142
-
143
-
1. Library.ApplicationCore:
144
-
145
-
- A core library targeting .NET 8.0.
146
-
- Likely contains core entities, enums, interfaces, and services.
147
-
- No external dependencies are defined in its project.assets.json.
148
-
149
-
2. Library.Infrastructure:
150
-
151
-
- Provides infrastructure-level functionality.
152
-
- Depends on Library.ApplicationCore and uses Microsoft.Extensions.Configuration and related packages.
153
-
- Targets .NET 8.0.
154
-
155
-
3. Library.Console:
156
-
157
-
- A console application that likely serves as the entry point for the project.
158
-
- Depends on Library.ApplicationCore and Library.Infrastructure.
159
-
- Uses Microsoft.Extensions.DependencyInjection, Microsoft.Extensions.Configuration.Json, and other related packages.
160
-
- Targets .NET 8.0.
161
-
162
-
4. UnitTests:
163
-
164
-
- A unit testing project for the solution.
165
-
- Depends on Library.ApplicationCore.
166
-
- Uses testing frameworks like xUnit, NSubstitute, and coverlet.collector.
167
-
- Targets .NET 8.0.
168
-
169
-
**Key Features**
170
-
171
-
- Dependency Injection: The use of Microsoft.Extensions.DependencyInjection suggests that the project employs dependency injection for managing dependencies.
172
-
- Configuration Management: The use of Microsoft.Extensions.Configuration and Microsoft.Extensions.Configuration.Json indicates support for configuration management, likely using JSON files.
173
-
- Unit Testing: The UnitTests project ensures the solution is well-tested with xUnit and mocking frameworks like NSubstitute.
174
-
- .NET 8.0: All projects target .NET 8.0, leveraging the latest features of the .NET ecosystem.
175
-
176
-
```
131
+
- **Library.ApplicationCore**
132
+
- **Library.Console**
133
+
- **Library.Infrastructure**
134
+
- **UnitTests**
177
135
178
136
1. Use the SOLUTION EXPLORER view to expand the project folders.
179
137
@@ -188,51 +146,16 @@ Use the following steps to complete this section of the exercise:
188
146
For example, enter the following prompt in the Chat view:
189
147
190
148
```plaintext
191
-
@workspace #class describe the ConsoleApp class
149
+
@workspace #usages How is the ConsoleApp class used?
192
150
```
193
151
194
-
Use chat variables, such as **#class**, to include specific context in your prompt. To see a list of the chat variables, type **#** in the chat prompt box.
152
+
Use chat variables, such as **#usages**, to include specific context in your prompt. To see a list of the chat variables, type **#** in the chat prompt box.
195
153
196
154
> **NOTE**: GitHub Copilot considers your chat history and the code files you have open in Visual Studio Code when constructing a context for your prompt and generating a response.
197
155
198
156
1. Take a minute to verify the accuracy of GitHub Copilot's response.
199
157
200
-
You should see a response similar to the following description:
201
-
202
-
```markdown
203
-
204
-
The ConsoleApp class in ConsoleApp.cs is responsible for managing the console-based user interface of the library management system. It handles user interactions, processes user inputs, and coordinates actions with the underlying services and repositories.
205
-
206
-
**Fields**
207
-
208
-
- _currentState: Tracks the current state of the console application.
209
-
- matchingPatrons: A list of patrons that match a search query.
210
-
- selectedPatronDetails: Holds details of the currently selected patron.
211
-
- selectedLoanDetails: Holds details of the currently selected loan.
212
-
- _patronRepository: An instance of IPatronRepository for accessing patron data.
213
-
- _loanRepository: An instance of ILoanRepository for accessing loan data.
214
-
- _loanService: An instance of ILoanService for performing loan-related operations.
215
-
- _patronService: An instance of IPatronService for performing patron-related operations.
216
-
217
-
**Constructor**
218
-
219
-
- ConsoleApp(ILoanService loanService, IPatronService patronService, IPatronRepository patronRepository, ILoanRepository loanRepository): Initializes the ConsoleApp with the provided services and repositories.
220
-
221
-
**Methods**
222
-
223
-
- Run(): The main entry point for running the console application.
224
-
- PatronSearch(): Handles the logic for searching patrons.
225
-
- ReadPatronName(): Reads the patron's name from the console input.
226
-
- PrintPatronsList(List<Patron> matchingPatrons): Prints a list of matching patrons to the console.
227
-
- PatronSearchResults(): Handles the logic for displaying and selecting from the search results.
228
-
- ReadInputOptions(CommonActions options, out int optionNumber): Reads input options from the console.
229
-
- WriteInputOptions(CommonActions options): Writes the available input options to the console.
230
-
- PatronDetails(): Displays details of the selected patron.
231
-
- LoanDetails(): Displays details of the selected loan and handles actions like extending or returning the loan.
232
-
233
-
The class uses a state machine approach to manage different states of the console application, such as searching for patrons, displaying search results, showing patron details, and handling loan details.
234
-
235
-
```
158
+
You should see a response that the describes where the **ConsoleApp** class is defined and how it's used in the codebase. The ConsoleApp.cs and Program.cs files are referenced in the response, along with line numbers
236
159
237
160
1. Open the **Program.cs** file and examine the code.
238
161
@@ -275,30 +198,14 @@ Use the following steps to complete this section of the exercise:
275
198
For example, enter the following prompt in the Chat view:
276
199
277
200
```plaintext
278
-
@workspace Explain how the data access classes work
201
+
@workspace /explain Explain how the data access classes work
279
202
```
280
203
281
-
1. Take a couple minutes to review the response.
282
-
283
-
You should see a response that includes information similar to the following description:
284
-
285
-
```markdown
286
-
The `JsonData` class in`JsonData.cs` is responsible for managing the loading and saving of data from JSON files. It handles various entities such as `Author`, `Book`, `BookItem`, Patron`, and `Loan`. The class uses the `IConfiguration` interface to read file paths from the configuration settings, ensuring that the correct JSON files are loaded.
287
-
288
-
The constructor of the `JsonData` class initializes the file paths foreach entity by reading from the configuration section "JsonPaths". If the paths are not specifiedin the configuration, it defaults to specific paths within a "Json" directory.
289
-
290
-
The `EnsureDataLoaded` method checks if the data is already loaded and, if not, calls the `LoadData` method to load the data from the JSON files. The `LoadData` method reads the JSON files and deserializes them into the respective lists of entities.
291
-
292
-
The `SaveLoans` and `SavePatrons` methods handle saving the loan and patron data back to the JSON files. These methods ensure that only a subset of properties is saved, maintaining data integrity and consistency.
293
-
294
-
The class also provides methods to populate entities with related data. For example, `GetPopulatedPatrons` and `GetPopulatedPatron` methods populate patron entities with their associated loans. Similarly, `GetPopulatedLoan` and `GetPopulatedBookItem` methods populate loan and book item entities with their related data.
295
-
296
-
The `LoadJson` and `SaveJson` methods are utility methods for reading from and writing to JSON files. They use the `JsonSerializer` class to handle the serialization and deserialization processes.
297
-
298
-
Overall, the `JsonData` class serves as a central point formanaging the persistence of datain JSON format, ensuring that the application can load, save, and manipulate data efficiently.
299
-
```
204
+
1. Take a couple minutes to read through the response.
205
+
206
+
You should see a response that describes each of the data access classes (**JsonData**, **JsonLoanRepository**, and **JsonPatronRepository**) and how they work together to manage data access in the application. Key methods, such as **LoadData**, **SaveLoans**, and **SavePatrons**, should be mentioned in the response.
300
207
301
-
1. Take a couple minutes to examine the JSON data files that are used to simulate library records.
208
+
1. Take a minute to examine the JSON data files that are used to simulate library records.
302
209
303
210
The JSON data files are located in the **src/Library.Console/Json** folder.
304
211
@@ -397,89 +304,13 @@ Use the following steps to complete this section of the exercise:
397
304
398
305
1. Copy the suggested documentation, and then paste it into the README.md file.
399
306
400
-
To copy the entire response, scroll to the bottom of the response, right-click in the empty space to the right of the "thumbs-up" icon, and thenselect**Copy All**
307
+
To copy the entire response, scroll to the bottom of the response, right-click in the empty space to the right of the "thumbs-up" icon, and thenselect**Copy**
401
308
402
309
1. Format the README.md file as needed.
403
310
404
-
You should have a README.md file that looks similar to the following example:
405
-
406
-
```markdown
407
-
408
-
# Library App
409
-
410
-
## Description
411
-
412
-
Library App is a modular application designed to manage library operations such as book loans, patron management, and inventory tracking. It is built using .NET and follows a clean architecture approach to ensure scalability and maintainability.
413
-
414
-
## Project Structure
415
-
416
-
- `AccelerateDevGHCopilot.sln` - Solution file for the project.
417
-
- `src/`
418
-
- `Library.ApplicationCore/`
419
-
- `Entities/` - Contains core domain entities.
420
-
- `Enums/` - Defines enumerations used across the application.
421
-
- `Interfaces/` - Declares interfaces for core abstractions.
422
-
- `Services/` - Implements business logic and domain services.
423
-
- `Library.ApplicationCore.csproj` - Project file for the Application Core.
424
-
- `Library.Console/`
425
-
- `appSettings.json` - Configuration file for the console application.
426
-
- `CommonActions.cs` - Contains reusable actions for the console app.
427
-
- `ConsoleApp.cs` - Main application logic for the console interface.
428
-
- `ConsoleState.cs` - Manages the state of the console application.
429
-
- `Program.cs` - Entry point for the console application.
430
-
- `Json/` - Contains JSON-related utilities or data.
431
-
- `Library.Console.csproj` - Project file for the Console application.
432
-
- `Library.Infrastructure/`
433
-
- `Data/` - Contains data access implementations.
434
-
- `Library.Infrastructure.csproj` - Project file for the Infrastructure layer.
435
-
- `tests/`
436
-
- `UnitTests/`
437
-
- `LoanFactory.cs` - Factory for creating test data related to loans.
438
-
- `PatronFactory.cs` - Factory for creating test data related to patrons.
439
-
- `ApplicationCore/` - Contains unit tests for the Application Core.
440
-
- `UnitTests.csproj` - Project file for unit tests.
441
-
442
-
## Key Classes and Interfaces
443
-
444
-
- **Entities**
445
-
- `Book` - Represents a book in the library.
446
-
- `Patron` - Represents a library patron.
447
-
- `Loan` - Represents a loan transaction.
448
-
- **Interfaces**
449
-
- `IBookRepository` - Interface for book-related data operations.
450
-
- `IPatronRepository` - Interface for patron-related data operations.
451
-
- `ILoanService` - Interface for managing loan operations.
452
-
- **Services**
453
-
- `LoanService` - Implements loan-related business logic.
454
-
- `NotificationService` - Handles notifications for overdue loans.
455
-
456
-
## Usage
457
-
458
-
1. Clone the repository:
459
-
460
-
```bash
461
-
git clone <repository-url>
462
-
```
463
-
464
-
2. Open the solution file AccelerateDevGHCopilot.sln in Visual Studio.
465
-
3. Build the solution to restore dependencies and compile the code.
466
-
4. Run the console application:
467
-
468
-
```dotnetcli
469
-
dotnet run --project src/Library.Console/Library.Console.csproj
470
-
```
471
-
472
-
5. Execute unit tests:
473
-
474
-
```dotnetcli
475
-
dotnet run --project src/Library.Console/Library.Console.csproj
476
-
```
477
-
478
-
## License
479
-
480
-
This project is licensed under the MIT License. See the LICENSE file for details.
311
+
You can update the settings for GitHub Copilot to enable markdown formatting, then use GitHub Copilot to help you update sections of the README.md file.
481
312
482
-
```
313
+
When you're finished, you should have a README.md file that includes each of the specified sections, with an appropriate level of detail.
Copy file name to clipboardExpand all lines: Instructions/Labs/LAB_AK_03_develop_code_features.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,7 +55,15 @@ You need to download the existing application, extract the code files, and then
55
55
56
56
Use the following steps to set up the library application:
57
57
58
-
1. To download a zip file containing the library application, select the following URL: [GitHub Copilot lab - develop code features](https://github.com/MicrosoftLearning/mslearn-github-copilot-dev/raw/refs/heads/main/DownloadableCodeProjects/Downloads/AZ2007LabAppM3.zip)
58
+
1. Open a command terminal and then run the following command:
1. To download a zip file containing the library application, navigate to the following URL: [GitHub Copilot lab - develop code features](https://github.com/MicrosoftLearning/mslearn-github-copilot-dev/raw/refs/heads/main/DownloadableCodeProjects/Downloads/AZ2007LabAppM3.zip)
Copy file name to clipboardExpand all lines: Instructions/Labs/LAB_AK_04_develop_unit_tests_xunit.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,15 @@ You need to download the existing application, extract the code files, and then
40
40
41
41
Use the following steps to set up the library application:
42
42
43
-
1. To download a zip file containing the library application, select the following URL: [GitHub Copilot lab - develop unit tests](https://github.com/MicrosoftLearning/mslearn-github-copilot-dev/raw/refs/heads/main/DownloadableCodeProjects/Downloads/AZ2007LabAppM4.zip)
43
+
1. Open a command terminal and then run the following command:
1. To download a zip file containing the library application, navigate to the following URL: [GitHub Copilot lab - develop unit tests](https://github.com/MicrosoftLearning/mslearn-github-copilot-dev/raw/refs/heads/main/DownloadableCodeProjects/Downloads/AZ2007LabAppM4.zip)
44
52
45
53
The zip file is named **AZ2007LabAppM4.zip**.
46
54
@@ -235,6 +243,7 @@ Use the following steps to complete this section of the exercise:
235
243
You should see an explanation that's similar to the following example:
236
244
237
245
```markdown
246
+
238
247
1. Add Project Reference:
239
248
240
249
- Open the UnitTests.csproj file located at tests/UnitTests/UnitTests.csproj.
@@ -284,7 +293,9 @@ Use the following steps to complete this section of the exercise:
284
293
1. To start an automated task that creates a test class for the JsonLoanRepository.GetLoan method, enter the following prompt:
285
294
286
295
```plaintext
296
+
287
297
Add `Infrastructure\JsonLoanRepository` folders to the UnitTests project and then create a class file named `GetLoan.cs`in the `JsonLoanRepository` folder. Add a reference to the Library.Infrastructure project inside UnitTests.csproj.
298
+
288
299
```
289
300
290
301
This prompt asks GitHub Copilot to create a new folder structure and class file in the UnitTests project.
@@ -432,7 +443,9 @@ Use the following steps to complete this section of the exercise:
432
443
1. Enter the following prompt:
433
444
434
445
```plaintext
446
+
435
447
@workspace Create fields and a class constructor forthe `GetLoan.cs` file. The class will be used to create unit tests for the GetLoan methodin the `JsonLoanRepository.cs` file. Create the following private readonly fields: `_mockLoanRepository`, `_jsonLoanRepository`, `_configuration`, and `_jsonData`. Instantiate the fields in the `GetLoanTest` constructor. Use `ConfigurationBuilder` to create a `_configuration` object that can be used to instantiate the JsonData object.
448
+
436
449
```
437
450
438
451
This prompt asks GitHub Copilot to suggest fields and a class constructor.
0 commit comments