fix fraud posibility the client sent the unit price (#702)
* fix fraud posibility the client sent the unit price, fix unit test to use the fomat as server base * fix bad coding convention * update dotnet tool ef and nuget package * Align MD with real database by default
This commit is contained in:
@@ -15,14 +15,14 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.4" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.4" />
|
||||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ public class IndexTest : IClassFixture<TestApplication>
|
||||
{
|
||||
new KeyValuePair<string, string>("id", "2"),
|
||||
new KeyValuePair<string, string>("name", "shirt"),
|
||||
new KeyValuePair<string, string>("price", "19.49"),
|
||||
new KeyValuePair<string, string>("__RequestVerificationToken", token)
|
||||
};
|
||||
var formContent = new FormUrlEncodedContent(keyValues);
|
||||
@@ -45,7 +44,7 @@ public class IndexTest : IClassFixture<TestApplication>
|
||||
var updateKeyValues = new List<KeyValuePair<string, string>>
|
||||
{
|
||||
new KeyValuePair<string, string>("Items[0].Id", WebPageHelpers.GetId(stringResponse)),
|
||||
new KeyValuePair<string, string>("Items[0].Quantity", "50"),
|
||||
new KeyValuePair<string, string>("Items[0].Quantity", "49"),
|
||||
new KeyValuePair<string, string>(WebPageHelpers.TokenTag, WebPageHelpers.GetRequestVerificationToken(stringResponse))
|
||||
};
|
||||
var updateContent = new FormUrlEncodedContent(updateKeyValues);
|
||||
@@ -54,7 +53,8 @@ public class IndexTest : IClassFixture<TestApplication>
|
||||
var stringUpdateResponse = await updateResponse.Content.ReadAsStringAsync();
|
||||
|
||||
Assert.Contains("/basket/update", updateResponse.RequestMessage.RequestUri.ToString());
|
||||
Assert.Contains("974.50", stringUpdateResponse);
|
||||
decimal expectedTotalAmount = 416.50M;
|
||||
Assert.Contains(expectedTotalAmount.ToString("N2"), stringUpdateResponse);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -72,7 +72,6 @@ public class IndexTest : IClassFixture<TestApplication>
|
||||
{
|
||||
new KeyValuePair<string, string>("id", "2"),
|
||||
new KeyValuePair<string, string>("name", "shirt"),
|
||||
new KeyValuePair<string, string>("price", "19.49"),
|
||||
new KeyValuePair<string, string>("__RequestVerificationToken", token)
|
||||
};
|
||||
var formContent = new FormUrlEncodedContent(keyValues);
|
||||
@@ -95,6 +94,5 @@ public class IndexTest : IClassFixture<TestApplication>
|
||||
|
||||
Assert.Contains("/basket/update", updateResponse.RequestMessage.RequestUri.ToString());
|
||||
Assert.Contains("Basket is empty", stringUpdateResponse);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.4" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="Moq" Version="4.17.2" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
|
||||
@@ -20,10 +20,10 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.3" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.4" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.9" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.9" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user