Skip to content

Commit f9987cb

Browse files
Salvatore PiccioneSalvatore Piccione
authored andcommitted
feat: improve test readability
1 parent 6d8d7dc commit f9987cb

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

exercises/concept/authentication-system/AuthenticationSystemTests.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ public void GetAdmin()
1818
[Task(4)]
1919
public void CheckAdminCannotBeTampered()
2020
{
21-
var admin = new Identity { EyeColor = "green", Email = "admin@ex.ism" };
21+
var adminEmail = "admin@ex.ism";
22+
var admin = new Identity { EyeColor = "green", Email = adminEmail };
2223
var authenticator = new Authenticator(admin);
2324
var tamperedAdmin = authenticator.Admin;
2425
tamperedAdmin.Email = "admin@hack.ed";
25-
Assert.NotEqual(tamperedAdmin.Email, authenticator.Admin.Email);
26+
Assert.Equal(adminEmail, authenticator.Admin.Email);
2627
}
2728

2829
[Fact]
@@ -44,13 +45,6 @@ public void CheckDevelopersCannotBeTampered()
4445
IDictionary<string, Identity> devs = authenticator.GetDevelopers();
4546

4647
Identity tamperedDev = new Identity { EyeColor = "grey", Email = "anders@hack.ed" };
47-
try
48-
{
49-
devs["Anders"] = tamperedDev;
50-
Assert.True(false, "Unexpected change to developers list.");
51-
} catch (NotSupportedException)
52-
{
53-
Assert.True(true);
54-
}
48+
Assert.Throws<NotSupportedException>(() => devs["Anders"] = tamperedDev);
5549
}
5650
}

0 commit comments

Comments
 (0)