-
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.
Use interfaces instead classes. Unit testing. Change version to v1.1.0
- Loading branch information
Showing
21 changed files
with
705 additions
and
72 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
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
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
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,160 @@ | ||
namespace RAE.Tests; | ||
|
||
public class DRAE | ||
{ | ||
private RAE.DRAE Drae { get; } = new RAE.DRAE(); | ||
|
||
[Theory] | ||
[InlineData("-ato")] | ||
[InlineData("en")] | ||
[InlineData("en-")] | ||
[InlineData("manada")] | ||
[InlineData("niño")] | ||
[InlineData("tonto")] | ||
[InlineData("y")] | ||
public async Task FetchWordsExist(string word) | ||
{ | ||
IList<IWord> words = await Drae.FetchWordsAsync(word); | ||
|
||
Assert.NotNull(words); | ||
Assert.NotEmpty(words); | ||
} | ||
|
||
[Theory] | ||
[InlineData("asdadasdada")] | ||
public async Task FetchWordsNoExist(string word) | ||
{ | ||
IList<IWord> words = await Drae.FetchWordsAsync(word); | ||
|
||
Assert.NotNull(words); | ||
Assert.Empty(words); | ||
} | ||
|
||
[Theory] | ||
[InlineData("SPSNBuG")] //pelo | ||
[InlineData("R9dHZWB")] //ordenador | ||
public async Task FetchWordByIdExist(string wordId) | ||
{ | ||
IWord word = await Drae.FetchWordByIdAsync(wordId); | ||
|
||
Assert.NotNull(word); | ||
} | ||
|
||
[Theory] | ||
[InlineData("sadafasda")] | ||
public async Task FetchWordByIdNoExist(string wordId) | ||
{ | ||
IWord word = await Drae.FetchWordByIdAsync(wordId); | ||
|
||
Assert.Null(word); | ||
} | ||
|
||
[Fact] | ||
public async Task GetAllWords() | ||
{ | ||
string[] allWords = await Drae.GetAllWordsAsync(); | ||
|
||
Assert.NotNull(allWords); | ||
Assert.NotEmpty(allWords); | ||
} | ||
|
||
[Theory] | ||
[InlineData("a")] | ||
[InlineData("la")] | ||
public async Task GetKeysExist(string query) | ||
{ | ||
string[] keys = await Drae.GetKeysAsync(query); | ||
|
||
Assert.NotNull(keys); | ||
Assert.NotEmpty(keys); | ||
} | ||
|
||
[Theory] | ||
[InlineData("asdasdsad")] | ||
public async Task GetKeysNoExist(string query) | ||
{ | ||
string[] keys = await Drae.GetKeysAsync(query); | ||
|
||
Assert.NotNull(keys); | ||
Assert.Empty(keys); | ||
} | ||
|
||
[Fact] | ||
public async Task GetRandomWord() | ||
{ | ||
IWord word = await Drae.GetRandomWordAsync(); | ||
|
||
Assert.NotNull(word); | ||
} | ||
|
||
[Fact] | ||
public async Task GetWordOfTheDay() | ||
{ | ||
IEntry word = await Drae.GetWordOfTheDayAsync(); | ||
|
||
Assert.NotNull(word); | ||
} | ||
|
||
[Theory] | ||
[InlineData("a")] | ||
[InlineData("la")] | ||
public async Task GetWordsStartWithExist(string query) | ||
{ | ||
string[] words = await Drae.GetWordsStartWithAsync(query); | ||
|
||
Assert.NotNull(words); | ||
Assert.NotEmpty(words); | ||
} | ||
|
||
[Theory] | ||
[InlineData("aadadsadasdc")] | ||
public async Task GetWordsStartWithNoExist(string query) | ||
{ | ||
string[] words = await Drae.GetWordsStartWithAsync(query); | ||
|
||
Assert.NotNull(words); | ||
Assert.Empty(words); | ||
} | ||
|
||
[Theory] | ||
[InlineData("a")] | ||
[InlineData("la")] | ||
public async Task GetWordsContainExist(string query) | ||
{ | ||
string[] words = await Drae.GetWordsContainAsync(query); | ||
|
||
Assert.NotNull(words); | ||
Assert.NotEmpty(words); | ||
} | ||
|
||
[Theory] | ||
[InlineData("dfsdfsdfsfdsa")] | ||
public async Task GetWordsContainNoExist(string query) | ||
{ | ||
string[] words = await Drae.GetWordsContainAsync(query); | ||
|
||
Assert.NotNull(words); | ||
Assert.Empty(words); | ||
} | ||
|
||
[Theory] | ||
[InlineData("avión")] | ||
[InlineData("planeta")] | ||
public async Task SearchWordExist(string word) | ||
{ | ||
IEntry[] entries = await Drae.SearchWordAsync(word, true); | ||
|
||
Assert.NotNull(entries); | ||
Assert.NotEmpty(entries); | ||
} | ||
|
||
[Theory] | ||
[InlineData("sdfsfsdfsfssdfsdfs")] | ||
public async Task SearchWordNoExist(string word) | ||
{ | ||
IEntry[] entries = await Drae.SearchWordAsync(word, true); | ||
|
||
Assert.NotNull(entries); | ||
Assert.Empty(entries); | ||
} | ||
} |
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,29 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net7.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" /> | ||
<PackageReference Include="xunit" Version="2.4.2" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
<PackageReference Include="coverlet.collector" Version="3.2.0"> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
<PrivateAssets>all</PrivateAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\RAE\RAE.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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 @@ | ||
global using Xunit; |
Oops, something went wrong.