-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust unit test project name and add ScriptDictionary tests
- Loading branch information
1 parent
9e823f5
commit 3280ef2
Showing
22 changed files
with
76 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("Mockaco.Tests")] | ||
[assembly: InternalsVisibleTo("Mockaco.AspNetCore.Tests")] | ||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] |
73 changes: 73 additions & 0 deletions
73
test/Mockaco.AspNetCore.Tests/Common/StringDictionaryTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using Xunit; | ||
using Mockaco; | ||
using FluentAssertions; | ||
|
||
public class StringDictionaryTests | ||
{ | ||
[Fact] | ||
public void Add_WhenKeyNotExists_AddsKeyValue() | ||
{ | ||
var dictionary = new StringDictionary(); | ||
var key = "testKey"; | ||
var value = "testValue"; | ||
dictionary.Add(key, value); | ||
dictionary.ContainsKey(key).Should().BeTrue(); | ||
dictionary[key].Should().Be(value); | ||
} | ||
|
||
[Fact] | ||
public void Add_WhenKeyExists_ReplacesValue() | ||
{ | ||
var dictionary = new StringDictionary(); | ||
var key = "testKey"; | ||
var initialValue = "initialValue"; | ||
var newValue = "newValue"; | ||
dictionary.Add(key, initialValue); | ||
dictionary.Add(key, newValue); | ||
dictionary.ContainsKey(key).Should().BeTrue(); | ||
dictionary[key].Should().Be(newValue); | ||
} | ||
|
||
[Fact] | ||
public void Replace_WhenKeyNotExists_AddsKeyValue() | ||
{ | ||
var dictionary = new StringDictionary(); | ||
var key = "testKey"; | ||
var value = "testValue"; | ||
dictionary.Replace(key, value); | ||
dictionary.ContainsKey(key).Should().BeTrue(); | ||
dictionary[key].Should().Be(value); | ||
} | ||
|
||
[Fact] | ||
public void Replace_WhenKeyExists_ReplacesValue() | ||
{ | ||
var dictionary = new StringDictionary(); | ||
var key = "testKey"; | ||
var initialValue = "initialValue"; | ||
var newValue = "newValue"; | ||
dictionary.Add(key, initialValue); | ||
dictionary.Replace(key, newValue); | ||
dictionary.ContainsKey(key).Should().BeTrue(); | ||
dictionary[key].Should().Be(newValue); | ||
} | ||
|
||
[Fact] | ||
public void Indexer_Get_WhenKeyNotExists_ReturnsEmptyString() | ||
{ | ||
var dictionary = new StringDictionary(); | ||
var key = "testKey"; | ||
var value = dictionary[key]; | ||
value.Should().BeEmpty(); | ||
} | ||
|
||
[Fact] | ||
public void Indexer_Set_UpdatesValue() | ||
{ | ||
var dictionary = new StringDictionary(); | ||
var key = "testKey"; | ||
var value = "testValue"; | ||
dictionary[key] = value; | ||
dictionary[key].Should().Be(value); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.