Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from dsanchezcr/packages-update
Packages update to v2.0.0
- Loading branch information
Showing
15 changed files
with
369 additions
and
389 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions
9
src/NuGet/ConsoleClient/ConsoleClient.csproj → src/NuGet/ClientConsole/ClientConsole.csproj
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,11 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="ColonesExchangeRate" Version="1.0.1" /> | ||
<ProjectReference Include="..\ColonesExchangeRate\ColonesExchangeRate.csproj" /> | ||
</ItemGroup> | ||
</Project> | ||
|
||
</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,24 @@ | ||
var converter = new ColonesExchangeRate(); | ||
var amount = 1000; | ||
|
||
decimal dollarsToColones = await converter.DollarsToColones(amount); | ||
decimal colonesToDollars = await converter.ColonesToDollars(amount); | ||
decimal dollarsToEuros = await converter.DollarsToEuros(amount); | ||
decimal eurosToDollars = await converter.EurosToDollars(amount); | ||
decimal colonesToEuros = await converter.ColonesToEuros(amount); | ||
decimal eurosToColones = await converter.EurosToColones(amount); | ||
var dollarExchangeRate = await converter.GetDollarExchangeRate(); | ||
var euroExchangeRate = await converter.GetEuroExchangeRate(); | ||
|
||
Console.WriteLine($"{amount} Dollars = {dollarsToColones} Colones"); | ||
Console.WriteLine($"{amount} Colones = {colonesToDollars} Dollars"); | ||
Console.WriteLine($"{amount} Dollars = {dollarsToEuros} Euros"); | ||
Console.WriteLine($"{amount} Euros = {eurosToDollars} Dollars"); | ||
Console.WriteLine($"{amount} Colones = {colonesToEuros} Euros"); | ||
Console.WriteLine($"{amount} Euros = {eurosToColones} Colones"); | ||
|
||
Console.WriteLine($"Dollar exchange rate: {dollarExchangeRate.date} - Sale: {dollarExchangeRate.sale} - Purchase: {dollarExchangeRate.purchase}"); | ||
if (euroExchangeRate.colones != null) | ||
Console.WriteLine($"Euro exchange rate: {euroExchangeRate.date} - Dollars: {euroExchangeRate.dollars} - Colones: {euroExchangeRate.colones}"); | ||
else | ||
Console.WriteLine($"Euro exchange rate: {euroExchangeRate.date} - Dollars: {euroExchangeRate.dollars}"); |
171 changes: 84 additions & 87 deletions
171
src/NuGet/ColonesExchangeRate.Tests/CurrencyConverterTests.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 |
---|---|---|
@@ -1,106 +1,103 @@ | ||
using Xunit; | ||
namespace ColonesExchangeRate.Tests | ||
public class CurrencyConverterTests | ||
{ | ||
public class CurrencyConverterTests | ||
private readonly ColonesExchangeRate _colonesExchangeRate; | ||
public CurrencyConverterTests() | ||
{ | ||
private readonly CurrencyConverter _converter; | ||
public CurrencyConverterTests() | ||
{ | ||
_converter = new CurrencyConverter(); | ||
} | ||
[Fact] | ||
public async Task DollarsToColones_ShouldReturnNonNegativeDecimal() | ||
{ | ||
// Arrange | ||
decimal amount = 10; | ||
_colonesExchangeRate = new ColonesExchangeRate(); | ||
} | ||
[Fact] | ||
public async Task DollarsToColones_ShouldReturnNonNegativeDecimal() | ||
{ | ||
// Arrange | ||
decimal amount = 10; | ||
|
||
// Act | ||
var result = await _converter.DollarsToColones(amount); | ||
// Act | ||
var result = await _colonesExchangeRate.DollarsToColones(amount); | ||
|
||
// Assert | ||
Assert.True(result > 0); | ||
} | ||
[Fact] | ||
public async Task ColonesToDollars_ShouldReturnNonNegativeDecimal() | ||
{ | ||
// Arrange | ||
decimal amount = 10000; | ||
// Assert | ||
Assert.True(result > 0); | ||
} | ||
[Fact] | ||
public async Task ColonesToDollars_ShouldReturnNonNegativeDecimal() | ||
{ | ||
// Arrange | ||
decimal amount = 10000; | ||
|
||
// Act | ||
var result = await _converter.ColonesToDollars(amount); | ||
// Act | ||
var result = await _colonesExchangeRate.ColonesToDollars(amount); | ||
|
||
// Assert | ||
Assert.True(result > 0); | ||
} | ||
[Fact] | ||
public async Task DollarsToEuros_ShouldReturnNonNegativeDecimal() | ||
{ | ||
// Arrange | ||
decimal amount = 10; | ||
// Assert | ||
Assert.True(result > 0); | ||
} | ||
[Fact] | ||
public async Task DollarsToEuros_ShouldReturnNonNegativeDecimal() | ||
{ | ||
// Arrange | ||
decimal amount = 10; | ||
|
||
// Act | ||
var result = await _converter.DollarsToEuros(amount); | ||
// Act | ||
var result = await _colonesExchangeRate.DollarsToEuros(amount); | ||
|
||
// Assert | ||
Assert.True(result > 0); | ||
} | ||
[Fact] | ||
public async Task EurosToDollars_ShouldReturnNonNegativeDecimal() | ||
{ | ||
// Arrange | ||
decimal amount = 10; | ||
// Assert | ||
Assert.True(result > 0); | ||
} | ||
[Fact] | ||
public async Task EurosToDollars_ShouldReturnNonNegativeDecimal() | ||
{ | ||
// Arrange | ||
decimal amount = 10; | ||
|
||
// Act | ||
var result = await _converter.EurosToDollars(amount); | ||
// Act | ||
var result = await _colonesExchangeRate.EurosToDollars(amount); | ||
|
||
// Assert | ||
Assert.True(result > 0); | ||
} | ||
[Fact] | ||
public async Task EurosToColones_ShouldReturnNonNegativeDecimal() | ||
{ | ||
// Arrange | ||
decimal amount = 10; | ||
// Assert | ||
Assert.True(result > 0); | ||
} | ||
[Fact] | ||
public async Task EurosToColones_ShouldReturnNonNegativeDecimal() | ||
{ | ||
// Arrange | ||
decimal amount = 10; | ||
|
||
// Act | ||
var result = await _converter.EurosToColones(amount); | ||
// Act | ||
var result = await _colonesExchangeRate.EurosToColones(amount); | ||
|
||
// Assert | ||
Assert.True(result > 0); | ||
} | ||
[Fact] | ||
public async Task ColonesToEuros_ShouldReturnNonNegativeDecimal() | ||
{ | ||
// Arrange | ||
decimal amount = 10000; | ||
// Assert | ||
Assert.True(result > 0); | ||
} | ||
[Fact] | ||
public async Task ColonesToEuros_ShouldReturnNonNegativeDecimal() | ||
{ | ||
// Arrange | ||
decimal amount = 10000; | ||
|
||
// Act | ||
var result = await _converter.ColonesToEuros(amount); | ||
// Act | ||
var result = await _colonesExchangeRate.ColonesToEuros(amount); | ||
|
||
// Assert | ||
Assert.True(result > 0); | ||
} | ||
[Fact] | ||
public async Task GetDollarExchangeRate_ShouldReturnNonNegativeValues() | ||
{ | ||
// Act | ||
var (date, sale, purchase) = await _converter.GetDollarExchangeRate(true); | ||
// Assert | ||
Assert.True(result > 0); | ||
} | ||
[Fact] | ||
public async Task GetDollarExchangeRate_ShouldReturnValues() | ||
{ | ||
// Act | ||
var (date, sale, purchase) = await _colonesExchangeRate.GetDollarExchangeRate(); | ||
|
||
// Assert | ||
Assert.True(sale > 0); | ||
Assert.True(purchase > 0); | ||
Assert.False(date == null); | ||
} | ||
[Fact] | ||
public async Task GetEuroExchangeRate_ShouldReturnNonNegativeValues() | ||
{ | ||
// Act | ||
var (date, dollars, colones) = await _converter.GetEuroExchangeRate(true); | ||
// Assert | ||
Assert.False(date == null); | ||
Assert.True(sale > 0); | ||
Assert.True(purchase > 0); | ||
} | ||
[Fact] | ||
public async Task GetEuroExchangeRate_ShouldReturnValues() | ||
{ | ||
// Act | ||
var (date, dollars, colones) = await _colonesExchangeRate.GetEuroExchangeRate(); | ||
|
||
// Assert | ||
Assert.True(dollars > 0); | ||
Assert.True(colones > 0); | ||
Assert.False(date == null); | ||
} | ||
// Assert | ||
Assert.False(date == null); | ||
Assert.True(dollars > 0); | ||
Assert.True(colones > 0 || colones == null); | ||
} | ||
} |
Oops, something went wrong.