-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
C# was expecting properties to be pascal case.
- Loading branch information
1 parent
20332ce
commit 6cfd045
Showing
5 changed files
with
134 additions
and
61 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
41 changes: 41 additions & 0 deletions
41
coster/tests/AzureVmCosterTests/Services/VmPricingParserTests.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,41 @@ | ||
using AzureVmCoster.Services; | ||
|
||
namespace AzureVmCosterTests.Services; | ||
|
||
public class VmPricingParserTests | ||
{ | ||
private readonly VmPricingParser _parser = new("TestPricing/"); | ||
|
||
[Fact] | ||
public void GivenValidPrice_ThenParseVm() | ||
{ | ||
// Act | ||
var prices = _parser.Parse(); | ||
|
||
// Assert | ||
var expectedPrices = new List<VmPricing> | ||
{ | ||
new() | ||
{ | ||
Region = "germany-west-central", | ||
OperatingSystem = "windows", | ||
Instance = "B2ts v2", | ||
VCpu = 2, | ||
Ram = 1, | ||
PayAsYouGo = 0.019m, | ||
PayAsYouGoWithAzureHybridBenefit = 0.0107m, | ||
OneYearSavingsPlan = 0.0153m, | ||
OneYearSavingsPlanWithAzureHybridBenefit = 0.0082m, | ||
ThreeYearSavingsPlan = 0.0131m, | ||
ThreeYearSavingsPlanWithAzureHybridBenefit = 0.0059m, | ||
OneYearReserved = 0.0135m, | ||
OneYearReservedWithAzureHybridBenefit = 0.0063m, | ||
ThreeYearReserved = 0.0113m, | ||
ThreeYearReservedWithAzureHybridBenefit = 0.0041m, | ||
Spot = 0.0063m, | ||
SpotWithAzureHybridBenefit = 0.0036m | ||
} | ||
}; | ||
prices.Should().BeEquivalentTo(expectedPrices); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
coster/tests/AzureVmCosterTests/TestPricing/vm-pricing_germany-west-central_windows.json
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,19 @@ | ||
[ | ||
{ | ||
"instance": "B2ts v2", | ||
"vCpu": 2, | ||
"ram": 1, | ||
"payAsYouGo": 0.019, | ||
"payAsYouGoWithAzureHybridBenefit": 0.0107, | ||
"oneYearSavingsPlan": 0.0153, | ||
"oneYearSavingsPlanWithAzureHybridBenefit": 0.0082, | ||
"threeYearSavingsPlan": 0.0131, | ||
"threeYearSavingsPlanWithAzureHybridBenefit": 0.0059, | ||
"oneYearReserved": 0.0135, | ||
"oneYearReservedWithAzureHybridBenefit": 0.0063, | ||
"threeYearReserved": 0.0113, | ||
"threeYearReservedWithAzureHybridBenefit": 0.0041, | ||
"spot": 0.0063, | ||
"spotWithAzureHybridBenefit": 0.0036 | ||
} | ||
] |