Skip to content

Commit 122885f

Browse files
committed
updates to remove code formatting from instruction text
1 parent 8b8dd8d commit 122885f

3 files changed

Lines changed: 97 additions & 97 deletions

File tree

Instructions/Labs/LAB_AK_03_develop_code_features.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ To implement the book availability feature, you'll need to complete the followin
215215
- The **SearchBooks** method should read a user provided book title.
216216
- Check if a book is available for loan, and display a message stating either:
217217

218-
- "`book.title` is available for loan", or
219-
- "`book.title` is on loan to another patron. The return due date is `loan.DueDate`."
218+
- "**book.title** is available for loan", or
219+
- "**book.title** is on loan to another patron. The return due date is **loan.DueDate**."
220220

221221
GitHub Copilot Chat can help you implement the code updates needed to complete the new feature.
222222

@@ -473,8 +473,8 @@ Use the following steps to complete this section of the exercise:
473473
1. Check if a book is available for loan.
474474
1. Display a message stating one of the following options:
475475
476-
- "`book.title` is available for loan"
477-
- "`book.title` is on loan to another patron. The return due date is `loan.DueDate`."
476+
- "**{book.title}** is available for loan"
477+
- "**{book.title}** is on loan to another patron. The return due date is **{loan.DueDate}**."
478478
479479
To build the message options, your code will need to access the following JSON files:
480480
@@ -495,7 +495,7 @@ Use the following steps to complete this section of the exercise:
495495
496496
> **NOTE**: Be sure to remove any code comments created by GitHub Copilot. Unnecessary and inaccurate comments can negatively influence GitHub Copilot's suggestions.
497497
498-
1. Select the `SearchBooks` method.
498+
1. Select the **SearchBooks** method.
499499
500500
1. Open the Chat view and then enter the following prompt:
501501

Instructions/Labs/LAB_AK_04_develop_unit_tests_xunit.md

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -261,15 +261,15 @@ Use the following steps to complete this section of the exercise:
261261
262262
2. Identify methods to test:
263263
264-
- Identify the methods in the `Library.Infrastructure` project that need to be tested. For example, if you want to test the `LoanService` class, identify the methods in the `LoanService` class that need to be tested.
264+
- Identify the methods in the **Library.Infrastructure** project that need to be tested. For example, if you want to test the **LoanService** class, identify the methods in the **LoanService** class that need to be tested.
265265
266266
3. Create Test Classes:
267267
268-
- Create new test classes in the `tests/UnitTests` directory to test the methods in the `Library.Infrastructure` project. For example, if you want to test `LoanService`, create a file named `LoanServiceTests.cs`.
268+
- Create new test classes in the **tests/UnitTests** directory to test the methods in the **Library.Infrastructure** project. For example, if you want to test **LoanService**, create a file named **LoanServiceTests.cs**.
269269
270270
4. Write Unit Tests:
271271
272-
- In the newly created test classes, write unit tests for the methods in the `Library.Infrastructure` project. Use the xUnit framework for writing tests and NSubstitute for mocking dependencies.
272+
- In the newly created test classes, write unit tests for the methods in the **Library.Infrastructure** project. Use the xUnit framework for writing tests and NSubstitute for mocking dependencies.
273273
274274
5. Run Tests:
275275
@@ -282,7 +282,7 @@ Use the following steps to complete this section of the exercise:
282282
283283
## Extend the UnitTests project to begin testing data access classes
284284
285-
The `Library.Infrastructure` project contains data access classes that interact with the file system to load and save data. The project includes the following classes:
285+
The **Library.Infrastructure** project contains data access classes that interact with the file system to load and save data. The project includes the following classes:
286286
287287
- JsonData: A class that loads and saves JSON data.
288288
- JsonLoanRepository: A class that implements the ILoanRepository interface and uses the JsonData class to load and save loan data.
@@ -333,19 +333,19 @@ Use the following steps to complete this section of the exercise:
333333
334334
When you select **Continue**, GitHub Copilot completes the following actions:
335335
336-
- Runs the mkdir command in the terminal to create the `Infrastructure\JsonLoanRepository` folders in the UnitTests project.
337-
- Creates a new file named `GetLoan.cs` in the `JsonLoanRepository` folder.
336+
- Runs the mkdir command in the terminal to create the **Infrastructure\JsonLoanRepository** folders in the UnitTests project.
337+
- Creates a new file named **GetLoan.cs** in the **JsonLoanRepository** folder.
338338
339339
1. Take a moment to review the updates.
340340
341341
You should see the following updates in the editor:
342342
343-
- The `UnitTests` project now includes a reference to `Library.Infrastructure.csproj`.
344-
- The `GetLoan.cs` file is created in the `Infrastructure\JsonLoanRepository` folder.
343+
- The **UnitTests** project now includes a reference to **Library.Infrastructure.csproj**.
344+
- The **GetLoan.cs** file is created in the **Infrastructure\JsonLoanRepository** folder.
345345
346346
1. In the Chat view, to accept all changes, select **Keep**.
347347
348-
1. In the SOLUTION EXPLORER view, expand the `Infrastructure\JsonLoanRepository` folder structure.
348+
1. In the SOLUTION EXPLORER view, expand the **Infrastructure\JsonLoanRepository** folder structure.
349349
350350
The folder structure should look like this:
351351
@@ -356,19 +356,19 @@ Use the following steps to complete this section of the exercise:
356356
357357
### Use the Edit mode to create unit tests for the GetLoan method
358358
359-
In this section of the exercise, you use GitHub Copilot's Edit mode to create unit tests for the `GetLoan` method in the `JsonLoanRepository` class.
359+
In this section of the exercise, you use GitHub Copilot's Edit mode to create unit tests for the **GetLoan** method in the **JsonLoanRepository** class.
360360
361361
Use the following steps to complete this section of the exercise:
362362
363363
1. In the Chat view, select the **Set Mode** button, and then select **Edit**.
364364
365365
The Chat view is now in Edit mode.
366366
367-
1. Open the `JsonLoanRepository.cs` file.
367+
1. Open the **JsonLoanRepository.cs** file.
368368
369-
`JsonLoanRepository.cs` is located in the `src/Library.Infrastructure/Data/` folder.
369+
**JsonLoanRepository.cs** is located in the **src/Library.Infrastructure/Data/** folder.
370370
371-
1. Take a minute to review the `JsonLoanRepository.cs` file.
371+
1. Take a minute to review the **JsonLoanRepository.cs** file.
372372
373373
```csharp
374374
using Library.ApplicationCore;
@@ -428,22 +428,22 @@ Use the following steps to complete this section of the exercise:
428428
}
429429
```
430430
431-
1. Notice the following details about the `JsonLoanRepository` class:
431+
1. Notice the following details about the **JsonLoanRepository** class:
432432
433-
- The `JsonLoanRepository` class contains two methods: `GetLoan` and `UpdateLoan`.
434-
- The `JsonLoanRepository` class uses a `JsonData` object to load and save loan data.
433+
- The **JsonLoanRepository** class contains two methods: **GetLoan** and **UpdateLoan**.
434+
- The **JsonLoanRepository** class uses a **JsonData** object to load and save loan data.
435435
436-
1. Take a minute to consider the field and constructor requirements for the `GetLoan` test class.
436+
1. Take a minute to consider the field and constructor requirements for the **GetLoan** test class.
437437
438-
The `JsonLoanRepository.GetLoan` method receives a loan ID parameter when it's called. The method uses `_jsonData.EnsureDataLoaded` to get the latest JSON data, and `_jsonData.Loans` to search for a matching loan. If the method finds a matching loan ID, it returns a populated loan object (`populated`). If the method is unable to find a matching loan ID, it returns `null`.
438+
The **JsonLoanRepository.GetLoan** method receives a loan ID parameter when it's called. The method uses **_jsonData.EnsureDataLoaded** to get the latest JSON data, and **_jsonData.Loans** to search for a matching loan. If the method finds a matching loan ID, it returns a populated loan object (**populated**). If the method is unable to find a matching loan ID, it returns **null**.
439439
440440
For the GetLoan unit tests:
441441
442-
- You can use a mock loan repository object (`_mockLoanRepository`) to help test the case where a matching ID is found. Load the mock with the ID you want to find. The `ReturnLoanTest` class demonstrates how to mock the `ILoanRepository` interface and instantiate a mock loan repository object.
442+
- You can use a mock loan repository object (**_mockLoanRepository**) to help test the case where a matching ID is found. Load the mock with the ID you want to find. The **ReturnLoanTest** class demonstrates how to mock the **ILoanRepository** interface and instantiate a mock loan repository object.
443443
444-
- You can use a non-mock loan repository object (`_jsonLoanRepository`) to test the case where no matching ID is found. Just specify a loan ID that you know isn't in the file (anything over 100 should work).
444+
- You can use a non-mock loan repository object (**_jsonLoanRepository**) to test the case where no matching ID is found. Just specify a loan ID that you know isn't in the file (anything over 100 should work).
445445
446-
- You'll need a `JsonData` object to create a non-mock `JsonLoanRepository` object. Since the `UnitTests` project doesn't have access to the `JsonData` object created by the `ConsoleApp` project, you'll need to create one using the `IConfiguration` interface.
446+
- You'll need a **JsonData** object to create a non-mock **JsonLoanRepository** object. Since the **UnitTests** project doesn't have access to the **JsonData** object created by the **ConsoleApp** project, you'll need to create one using the **IConfiguration** interface.
447447
448448
1. Open the GetLoan.cs test file and select the GetLoan class.
449449
@@ -506,15 +506,15 @@ Use the following steps to complete this section of the exercise:
506506
507507
> **NOTE**: Sample code in the following step shows updates that correct the following issues:
508508
509-
- If there's a conflict between the `UnitTests.Infrastructure.JsonLoanRepository` namespace and the `JsonLoanRepository` type specified in the code, you should update the namespace in GetLoans.cs to eliminate the conflict. Follow the pattern used in the `ReturnLoan.cs` and `RenewMembership.cs` files.
509+
- If there's a conflict between the **UnitTests.Infrastructure.JsonLoanRepository** namespace and the **JsonLoanRepository** type specified in the code, you should update the namespace in GetLoans.cs to eliminate the conflict. Follow the pattern used in the **ReturnLoan.cs** and **RenewMembership.cs** files.
510510
511-
- If `ILoanRepository` isn't recognized in your code, you may need to add a `using` directive for `Library.ApplicationCore` to the top of the file.
511+
- If **ILoanRepository** isn't recognized in your code, you may need to add a **using** directive for **Library.ApplicationCore** to the top of the file.
512512
513-
- If the `_configuration` object isn't instantiated correctly, you may need to update the code line containing `ConfigurationBuilder`. You can simplify the code to use `_configuration = new ConfigurationBuilder().Build();`.
513+
- If the **_configuration** object isn't instantiated correctly, you may need to update the code line containing **ConfigurationBuilder**. You can simplify the code to use **_configuration = new ConfigurationBuilder().Build();**.
514514
515-
- If a `using Library.ApplicationCore.Interfaces` is suggested by GitHub Copilot, you can delete it from the top of the file.
515+
- If a **using Library.ApplicationCore.Interfaces** is suggested by GitHub Copilot, you can delete it from the top of the file.
516516
517-
1. Update the `GetLoan.cs` file to match the following code snippet:
517+
1. Update the **GetLoan.cs** file to match the following code snippet:
518518
519519
```csharp
520520
using NSubstitute;
@@ -552,13 +552,13 @@ Use the following steps to complete this section of the exercise:
552552
- JsonData.cs
553553
- Loans.json.
554554
555-
1. Select the contents of the `GetLoan.cs` file, and then enter the following prompt in the Chat view:
555+
1. Select the contents of the **GetLoan.cs** file, and then enter the following prompt in the Chat view:
556556
557557
```plaintext
558558
@workspace Update the selection to include a unit test for the `JsonLoanRepository.GetLoan` method. The unit test should test the case where a loan ID is found in the data. Use `_mockLoanRepository` to arrange the expected return loan. Use `_jsonLoanRepository` to return an actual loan. Asserts should verify that the return loan ID matches the expected loan ID. Use a loan ID that exists in the `Loans.json` file.
559559
```
560560
561-
This prompt asks GitHub Copilot to suggest a unit test for the `JsonLoanRepository.GetLoan` method. The unit test should test the case where a loan ID is found in the data. The test should use `_mockLoanRepository` to arrange the expected return loan, `_jsonLoanRepository` to return an actual loan, and asserts to verify that the return loan ID matches the expected loan ID. The loan ID should exist in the `Loans.json` file.
561+
This prompt asks GitHub Copilot to suggest a unit test for the **JsonLoanRepository.GetLoan** method. The unit test should test the case where a loan ID is found in the data. The test should use **_mockLoanRepository** to arrange the expected return loan, **_jsonLoanRepository** to return an actual loan, and asserts to verify that the return loan ID matches the expected loan ID. The loan ID should exist in the **Loans.json** file.
562562
563563
1. Take a minute to review the updates suggested by GitHub Copilot.
564564
@@ -618,13 +618,13 @@ Use the following steps to complete this section of the exercise:
618618
619619
1. In the Chat view, to accept all updates, select **Keep**.
620620
621-
If the `Loan` class isn't recognized in your code, ensure that you have a `using Library.ApplicationCore.Entities;` statement at the top of the GetLoan.cs file. The `Loan` class is located in the `Library.ApplicationCore.Entities` namespace.
621+
If the **Loan** class isn't recognized in your code, ensure that you have a **using Library.ApplicationCore.Entities;** statement at the top of the GetLoan.cs file. The **Loan** class is located in the **Library.ApplicationCore.Entities** namespace.
622622
623-
1. Build the `AccelerateDevGitHubCopilot` solution to ensure there are no errors.
623+
1. Build the **AccelerateDevGitHubCopilot** solution to ensure there are no errors.
624624
625625
1. Use GitHub Copilot's autocompletion feature to create a test for the case where the loan ID isn't found.
626626
627-
Create a blank line after the `GetLoan_ReturnsLoanWhenLoanIdIsFound` method.
627+
Create a blank line after the **GetLoan_ReturnsLoanWhenLoanIdIsFound** method.
628628
629629
Accept the autocompletion suggestions to create a new test method.
630630
@@ -673,17 +673,17 @@ Use the following steps to complete this section of the exercise:
673673
674674
```
675675
676-
You can delete the code that mocks an expected loan, but you need a loan ID that doesn't exist in the `Loans.json` file.
676+
You can delete the code that mocks an expected loan, but you need a loan ID that doesn't exist in the **Loans.json** file.
677677
678-
Ensure that your "Returns null when loan ID is not found" unit test assigns a `loanId` value that isn't in the data set.
678+
Ensure that your "Returns null when loan ID is not found" unit test assigns a **loanId** value that isn't in the data set.
679679
680680
1. Notice that the unit tests require access to the JSON data files.
681681
682-
The `JsonLoanRepository.GetLoan` method uses a `JsonData` object to load and save loan data.
682+
The **JsonLoanRepository.GetLoan** method uses a **JsonData** object to load and save loan data.
683683
684-
The JSON data files are located in the `Library.Console\Json` folder. You need to update the `UnitTests.csproj` file to include these files in the test project.
684+
The JSON data files are located in the **Library.Console\Json** folder. You need to update the **UnitTests.csproj** file to include these files in the test project.
685685
686-
1. Add the following XML snippet to the `UnitTests.csproj` file:
686+
1. Add the following XML snippet to the **UnitTests.csproj** file:
687687
688688
```xml
689689
<ItemGroup>
@@ -698,7 +698,7 @@ Use the following steps to complete this section of the exercise:
698698
699699
## Run the unit tests
700700
701-
There are several ways to run the unit tests for the `JsonLoanRepository` class. You can use Visual Studio Code's Test Explorer, the integrated terminal, or the `dotnet test` command.
701+
There are several ways to run the unit tests for the **JsonLoanRepository** class. You can use Visual Studio Code's Test Explorer, the integrated terminal, or the **dotnet test** command.
702702
703703
Use the following steps to complete this section of the exercise:
704704
@@ -716,7 +716,7 @@ Use the following steps to complete this section of the exercise:
716716
717717
The Test Explorer is a tree view that shows all the test cases in your workspace. You can run/debug your test cases and view the test results using Test Explorer.
718718
719-
1. Expand **UnitTests** and the underlying nodes to locate `GetLoanTest`.
719+
1. Expand **UnitTests** and the underlying nodes to locate **GetLoanTest**.
720720
721721
1. Run the **JsonLoanRepository.GetLoan: Returns loan when loan ID is found** test case.
722722

0 commit comments

Comments
 (0)