Skip to content

Commit

Permalink
Added 2nd [intentionally failing compile] test to LunExLab. Now we're…
Browse files Browse the repository at this point in the history
… done, I think!
  • Loading branch information
AgileInstitute committed Feb 28, 2023
1 parent c015a18 commit 786cb16
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
6 changes: 3 additions & 3 deletions LunExLab/Account/Account.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace Accounts;
using LunEx;

// import LunExService.LunEx;
namespace Accounts;

public class Account {

public long TotalGain(Lot[] lots, int currentPrice) {
long total = 0;
foreach (Lot nextLot in lots) {
Expand Down
4 changes: 4 additions & 0 deletions LunExLab/Account/Account.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\LunExService\LunExService.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions LunExLab/AccountTests/AccountTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

<ItemGroup>
<ProjectReference Include="..\Account\Account.csproj" />
<ProjectReference Include="..\LunExService\LunExService.csproj" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions LunExLab/AccountTests/TotalGainTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

using Accounts;
using LunEx;

namespace AccountTests;

Expand All @@ -9,6 +10,21 @@ namespace AccountTests;
[TestClass]
public class TotalGainTests
{
[TestMethod]
public void WhenUsingLunEx()
{
// given
var firstLot = new Lot(100, 3000L);
var latestLot = new Lot(10, 400L);
Lot[] lots = { firstLot, latestLot };
Account account = new Account();
string symbol = "HE3";
// Current price of HE3 was 42 when we wrote this...

// when/then
Assert.AreEqual(1220L, account.TotalGain(lots, symbol, new LunExServices()));
}

[TestMethod]
public void WhenUsingInteger()
{
Expand Down

0 comments on commit 786cb16

Please sign in to comment.