|
1 |
| -using System; |
| 1 | +using System; |
2 | 2 | using System.Collections.Generic;
|
3 | 3 | using FluentAssertions;
|
4 | 4 | using NUnit.Framework;
|
5 | 5 | using Utilities.Extensions;
|
6 | 6 |
|
7 |
| -namespace Utilities.Tests.Extensions |
| 7 | +namespace Utilities.Tests.Extensions; |
| 8 | + |
| 9 | +public class DictionaryExtensionsTests |
8 | 10 | {
|
9 |
| - public class DictionaryExtensionsTests |
| 11 | + [Test] |
| 12 | + public void AddMany_ShouldThrowArgumentException_WhenKeyAlreadyExists() |
10 | 13 | {
|
11 |
| - [Test] |
12 |
| - public void AddMany_ShouldThrowArgumentException_WhenKeyAlreadyExists() |
13 |
| - { |
14 |
| - var dictionary = new Dictionary<string, int> { ["one"] = 1 }; |
15 |
| - var enumerable = new[] { ("one", 1), ("two", 2) }; |
| 14 | + var dictionary = new Dictionary<string, int> { ["one"] = 1 }; |
| 15 | + var enumerable = new[] { ("one", 1), ("two", 2) }; |
16 | 16 |
|
17 |
| - var action = () => dictionary.AddMany(enumerable); |
| 17 | + var action = () => dictionary.AddMany(enumerable); |
18 | 18 |
|
19 |
| - action.Should().Throw<ArgumentException>(); |
20 |
| - } |
| 19 | + action.Should().Throw<ArgumentException>(); |
| 20 | + } |
21 | 21 |
|
22 |
| - [Test] |
23 |
| - public void AddMany_ShouldAddAllKeyValuePairs() |
24 |
| - { |
25 |
| - var dictionary = new Dictionary<string, int> { ["one"] = 1 }; |
26 |
| - var enumerable = new[] { ("two", 2), ("three", 3) }; |
| 22 | + [Test] |
| 23 | + public void AddMany_ShouldAddAllKeyValuePairs() |
| 24 | + { |
| 25 | + var dictionary = new Dictionary<string, int> { ["one"] = 1 }; |
| 26 | + var enumerable = new[] { ("two", 2), ("three", 3) }; |
27 | 27 |
|
28 |
| - dictionary.AddMany(enumerable); |
| 28 | + dictionary.AddMany(enumerable); |
29 | 29 |
|
30 |
| - dictionary.Should().HaveCount(3); |
| 30 | + dictionary.Should().HaveCount(3); |
31 | 31 |
|
32 |
| - dictionary.Should().ContainKey("one").WhichValue.Should().Be(1); |
33 |
| - dictionary.Should().ContainKey("two").WhichValue.Should().Be(2); |
34 |
| - dictionary.Should().ContainKey("three").WhichValue.Should().Be(3); |
35 |
| - } |
| 32 | + dictionary.Should().ContainKey("one").WhichValue.Should().Be(1); |
| 33 | + dictionary.Should().ContainKey("two").WhichValue.Should().Be(2); |
| 34 | + dictionary.Should().ContainKey("three").WhichValue.Should().Be(3); |
36 | 35 | }
|
37 | 36 | }
|
0 commit comments