Lab 13.1: classify an estate with the 7 Rs
Run and extend a tested C# rule engine that classifies a fifteen-component bookshop estate (modelled on a classic .NET Framework and SQL Server monolith) into the seven migration strategies, groups chatty components into waves, and prints a change-board report, with no AWS account.
Assumes: .NET 10 LTS · xUnit v3 4.0.3 on Microsoft.Testing.Platform · Docker · labs/m13-migration-classifier. Verified against official sources on 2026-11-18.
Learning objectives
By the end of this lab you can:
- Run the classifier and read each recommendation, its effort size, confidence and reasons.
- Explain why a component was classified Retire, Retain, Relocate, Repurchase, Rehost, Replatform or Refactor, using the evidence in the inventory.
- Change a rule or a blocker weight and prove the change with a test.
- Read a wave plan and explain why a group of three components moves together in the last wave.
- Turn the tool's Markdown report into a change-board attachment.
Prerequisites
- The 7 Rs of migration, which explains the rules this lab encodes
- Docker Desktop (or the .NET 10 SDK installed locally)
- No AWS account, credentials or cloud resources are needed
Cost label
Free. Everything runs on your machine. Nothing is created in AWS, so there is nothing to bill and nothing to destroy.
Scenario
Harbourline Bank acquired a small online bookshop, and its estate is the practice ground for the real migration. The bookshop is a classic ASP.NET MVC and Web Forms monolith on .NET Framework with SQL Server, a Windows service using MSMQ, a file share of cover images, a vendor CRM, and a VMware VM in the warehouse. The change board has asked for one recommendation per component, with the evidence, plus a first wave plan. You will use the lab's classifier to produce it and then challenge its rules.
The inventory is fictional. It is modelled on the shape of the public aws-samples/bobs-used-bookstore-classic sample (a good real target for the later porting and database labs in this module), but it is not a copy of that sample. ⚠ VERIFY the real sample's component list before quoting it.
Architecture
The files
| Path | What it does |
|---|---|
src/Harbourline.Migration.Assessment/Model.cs | AppComponent, the enums for kind and strategy, and the Recommendation record |
.../Blockers.cs | Known porting blockers and their weights; the "hard" and "SQL Server engine only" sets |
.../Classifier.cs | The ordered rule list; the policy lives here |
.../WavePlanner.cs | Union-find over chatty dependencies, ordering by risk, wave chunking, warnings |
.../InventoryLoader.cs | JSON loading and validation (duplicates, unknown dependencies, criticality range) |
.../MarkdownReport.cs | The change-board report |
src/Harbourline.Migration.Tools/Program.cs | Console entry point |
tests/Harbourline.Migration.Tests | 61 tests over rules, loader and waves |
data/bookstore-inventory.json | The sample estate |
docs/sample-report.md | The expected report for --today 2026-11-18 |
Part A: run it and read the answer
Run the tests
From the repository root:
MSYS_NO_PATHCONV=1 docker run --rm --memory 3g \
-v "$PWD/labs/m13-migration-classifier:/src" \
-v cea-nuget-m13:/root/.nuget/packages \
-w /src mcr.microsoft.com/dotnet/sdk:10.0 \
sh -c "dotnet test --solution MigrationClassifier.slnx; find . -type d \( -name bin -o -name obj \) -prune -exec rm -rf {} +"Expected: Test run summary: Passed! with total: 61. The named volume cea-nuget-m13 keeps the NuGet cache so a second run is fast.
Print the report
MSYS_NO_PATHCONV=1 docker run --rm --memory 3g \
-v "$PWD/labs/m13-migration-classifier:/src" \
-v cea-nuget-m13:/root/.nuget/packages \
-w /src mcr.microsoft.com/dotnet/sdk:10.0 \
sh -c "dotnet run --project src/Harbourline.Migration.Tools -- data/bookstore-inventory.json --today 2026-11-18 --out docs/my-report.md; find . -type d \( -name bin -o -name obj \) -prune -exec rm -rf {} +"Open labs/m13-migration-classifier/docs/my-report.md and compare it with docs/sample-report.md. Pin --today: the decommission rule uses the date, so unpinned runs drift.
Read the summary
The sample estate yields: Retire 2, Retain 2, Relocate 1, Repurchase 1, Refactor 2, Replatform 5, Rehost 2. Every one of the seven strategies appears, which is deliberate: a test asserts it so the sample keeps teaching all seven.
Explain three decisions in your own words
Pick web-admin (Replatform despite high activity), db-reporting (Replatform to RDS, not Babelfish) and job-ftp-export (Retain). For each, write the evidence from the inventory and the rule that fired. If you cannot, read the Why column and the matching branch in Classifier.cs.
Part B: change a rule, prove it with a test
The classifier's rule order is the policy. Here is the .NET Framework branch you will modify:
var strategic = c.ChangesLast12Months >= StrategicChangeThreshold;
var hard = c.Blockers.Where(Blockers.Hard.Contains).ToList();
if (!strategic)
{
reasons.Add($"Few changes in the last year ({c.ChangesLast12Months}): rewriting returns little. Rehost to EC2 Windows with AWS Application Migration Service, modernise opportunistically.");
return MigrationStrategy.Rehost;
}
if (hard.Count > 0 || points > RefactorMaxPoints)
{
var hardText = hard.Count > 0 ? $" including hard blockers ({string.Join(", ", hard)})" : "";
reasons.Add($"Strategic, but {points} blocker points{hardText}: stay on .NET Framework for now (replatform onto Windows hosting), then strangle pieces out to .NET 10 over time.");
return MigrationStrategy.Replatform;
}
reasons.Add($"Strategic and portable ({points} blocker points, none hard): refactor to .NET 10 and containers.");
return MigrationStrategy.Refactor;Experiment 1: edit data/bookstore-inventory.json and set web-admin's changesLast12Months to 2. Predict the new strategy, then re-run. It becomes Rehost, because a rarely changed app does not justify a rewrite. Change it back.
Experiment 2: lower RefactorMaxPoints from 12 to 8 and run the tests. Sample_components_get_the_expected_strategy fails for web-storefront (9 points) and svc-order-processing (10 points), which now become Replatform. That failure is the test doing its job: it forces you to decide whether the new threshold is a deliberate policy change. If it is, update the expected values and write the reason in your pull request. Then revert.
Experiment 3: add a blocker. In Blockers.cs add public const string Biztalk = "Biztalk"; and [Biztalk] = 7, to the weights. Add a test:
[Fact]
public void Biztalk_counts_seven_points()
{
Assert.Equal(7, Blockers.WeightOf("Biztalk"));
}Note that an unknown blocker name works too: it counts two points and lowers confidence to Medium. A known name is better because it carries the right weight.
Part C: read the wave plan
WavePlanner unions components joined by chatty dependencies, so they land in the same move group:
foreach (var r in moving)
{
foreach (var dep in r.Component.DependsOn.Where(d => d.Chatty))
{
if (parent.ContainsKey(dep.TargetId))
{
parent[Find(r.Component.Id)] = Find(dep.TargetId);
continue;
}
// ...warn when the chatty target stays on-premises or is being retired
}
}In the sample, web-storefront and svc-order-processing both talk chattily to db-bookstore, so the three form one group with risk 4 (the highest criticality among them) and move in the last wave. The first wave is the book-cover file share (risk 1) and the reporting database (risk 2), the forgiving pair the team learns on.
The report also prints a warning: vm-warehouse-gateway talks chattily to the label printer manager, which is retained on-premises. That is exactly the situation where a VPN or Direct Connect latency test must pass before the VM moves.
Security considerations
⚠ Learning shortcut — not for production
The inventory is hand-written fictional data, the weights are teaching values, and the tool trusts the file. A real programme builds the inventory from discovery data, has application owners and security review each row, and stores the report with access control because it reveals dependencies and weaknesses. Never paste a real inventory into a public repository or an AI chat tool.
- Fictional data only. The components, users and dates here are invented.
- Evidence, not opinions. Each reason string states the rule that fired; keep that habit in real change documents.
- Personal data flag.
containsPersonalDataadds a data-protection review reason on databases. In a real programme, involve your DPO for anything that changes processor or location. This lab makes no legal claim.
Common mistakes
- Editing a threshold and fixing the failing test without thinking. The failure is the review prompt. Write down why the policy changed.
- Using today's real date without
--today. Results then change as the calendar moves. - Marking every dependency as chatty. Everything glues into one huge group and the plan has a single giant wave. Reserve
chattyfor latency-sensitive calls. - Leaving usage
nullfor web applications. Confidence drops to Low; measure it. - Misspelling a blocker. It counts two points and lowers confidence. Use the names in
Blockers.cs.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Inventory is not valid: ... | JSON syntax error or an unknown kind | Check the commas, and use a valid kind name |
depends on unknown component | A targetId that is not an id | Fix the spelling |
Duplicate component id | Two rows share an id (case-insensitive) | Rename one |
| Test cannot find the data file | The data file was moved | It is linked into the test output by the test .csproj; keep it at data/bookstore-inventory.json |
| Docker cannot mount the folder | Path conversion in Git Bash | Keep MSYS_NO_PATHCONV=1 and quote the path |
| Slow first run | NuGet restore into the empty volume | Re-run; the cache then persists |
Cost and cleanup
Nothing was created in AWS. Delete labs/m13-migration-classifier/docs/my-report.md if you do not want to keep it, and remove build output:
find labs/m13-migration-classifier -type d \( -name bin -o -name obj -o -name TestResults \) -prune -exec rm -rf {} +
# Optional: free the disk used by the NuGet cache volume
docker volume rm cea-nuget-m13Exercises
- 🟢 Guided: run Experiments 1 and 2, and write two sentences on what each taught you about the rule order.
- 🟡 Challenge: add a new component
svc-statement-generator(kindBackgroundService,.NET Framework 4.8, criticality 3, 12 changes a year, blockersComInteropandLocalFileState, depends chattily ondb-bookstore). Predict its strategy and wave, then check. Add a test that locks the result. - 🔴 Live problem: the head of operations says "everything in wave 5 must move before the Christmas trading freeze in six weeks, no exceptions." Using the plan, state which components are actually on the critical path, which risks you would raise (the shared database with the chatty group, the Windows hosting questions), and what you would offer instead (for example move the read-only pieces early).
Assignment
Replace the sample inventory with ten components from your own organisation (anonymised) or from Harbourline's three-application portfolio in the module assignment. Produce the report, add two tests for decisions you disagree with, and write a short note naming the three components whose classification most needs human review, and why.
Solutions
Experiment 1: with changesLast12Months at 2 (below the strategic threshold of 6), web-admin becomes Rehost because the "not strategic" check comes before the blocker checks. Experiment 2: lowering RefactorMaxPoints to 8 turns the storefront (9 points) and order service (10 points) into Replatform. Both experiments show that a single constant moves entire components between strategies, so each such change needs a recorded reason.
ComInterop is a hard blocker, so with 12 changes a year (strategic) the component is Replatform (stay on Windows, strangle later). Points are 6 + 3 = 9, effort Large. Because it depends chattily on db-bookstore, it joins the last-wave group with the storefront and the order service, so that group has four components. The test is Assert.Equal(MigrationStrategy.Replatform, ...) for this component plus an assertion that its group contains db-bookstore. The why: a hard blocker prevents refactor regardless of points, and chatty edges pull components into the group around the database.
Knowledge check
Answer: it has hard blockers (Web Forms and COM interop) and 14 blocker points. Hard blockers prevent a refactor, so the plan stays on Windows hosting and modernises later.
Answer: it uses SQL CLR and linked servers, which only the SQL Server engine provides, so the rule recommends Amazon RDS for SQL Server.
Answer: it unions the two components into one move group, so they migrate together and avoid a latency-sensitive call crossing a network link.
Answer: zero triggers Retire; unknown only lowers confidence. Retiring on missing data could switch off a needed system.
Answer: treat it as a policy review: decide whether the new outcome is intended, update the expected value, and record the reason in the change.
Interview questions
- "How would you make a migration classification defensible to an auditor?" Make every recommendation carry its rule and evidence, keep the rules in version control with tests, and record human overrides with a reason and an approver.
- "Why keep the rules in code instead of a spreadsheet?" Tests catch silent policy changes, results are repeatable, and reviews happen in pull requests.
Certification practice
A migration team finds that two applications call each other thousands of times per minute, with a latency budget of a few milliseconds. The applications are in different migration waves, and the link to AWS has 15 ms latency. What is the best action?
A. Migrate them in separate waves and accept timeouts B. Place both in the same move group so they migrate together C. Increase the timeouts to 60 seconds D. Retire one of them
Answer: B. Latency-sensitive neighbours should move together so their calls stay local. A and C leave the problem in place; D is not justified by the facts.
An assessment finds 12 applications with no users in the past year. What is the most cost-effective action before the migration?
A. Rehost all 12 to preserve them B. Confirm with owners and retire them, archiving data per policy C. Refactor them to serverless D. Move them to the cheapest EC2 instance type
Answer: B. Retiring eliminates both migration and running costs. The others spend money on unused systems.
Completion checklist
- I ran the 61 tests and saw them pass
- I printed the report and explained three decisions
- I changed a rule or weight and proved it with a test
- I read the wave plan and the on-premises latency warning
- I removed
bin/andobj/folders
Key takeaways
- The rule order is the policy; tests keep it honest.
- Every recommendation carries a reason and a confidence, which is what a change board reads.
- Hard blockers, change rate and source availability decide Refactor, Replatform or Rehost for .NET code.
- Chatty dependencies form move groups; the riskiest group moves last.
- No AWS account is needed to plan a migration well.
Further reading
Independent learning resource — not affiliated with, endorsed or sponsored by Amazon Web Services. AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. All banking data in examples is fictional. Sample architectures are for learning and are not automatically compliant with GDPR, PCI DSS or any banking regulation.
The 7 Rs of migration
Classify every application in a bank's estate as retire, retain, relocate, repurchase, rehost, replatform or refactor using an ordered decision rule, justify each choice with evidence, group chatty components into waves, and test the logic in a small C# classifier.
Migration assessment and portfolio discovery
Build a trustworthy inventory of a Microsoft estate, map dependencies, classify each application with the 7 Rs, group applications into waves, and produce the business-case numbers a bank's investment committee will accept, using AWS Transform and a small C# planning tool.