Skip to content

Commit

Permalink
number pages from 1
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanLarsson committed Apr 17, 2023
1 parent f676ce9 commit 24c0222
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 45 deletions.
2 changes: 1 addition & 1 deletion IbkrToSru/Sru.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static string Create(ImmutableArray<SruItem> items, int year, string pers
now = DateTime.Now;
}

var page = 0;
var page = 1;
foreach (var chunk in items.Chunk(9))
{
builder.AppendLine($"#BLANKETT K4-{year}P4");
Expand Down
120 changes: 76 additions & 44 deletions IbkrToSruTests/SruTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,67 +14,99 @@ public static class SruTest
new(
new[]
{
new Execution("USD", "AMC", new DateTime(2021, 11, 23, 12, 46, 38), 50, 39.83, -1991.5d, -1, 1992.5, 0),
new Execution("USD", "AMC", new DateTime(2021, 11, 30, 11, 55, 26), -50, 33.8, 1690, -1.014569, -1992.5, -303.514569),
new Execution("USD", "AEHR", new DateTime(2021, 10, 06, 09, 45, 56), 80, 14.24, -1139.2, -1, 1140.2, 0),
new Execution("USD", "AEHR", new DateTime(2021, 10, 07, 13, 09, 43), -80, 16.13, 1290.4, -1.01610104, -1140.2, 149.183899),
},
"#BLANKETT K4-2021P4\r\n" +
"#IDENTITET 197903054524 20220426 133009\r\n" +
"#UPPGIFT 3100 50\r\n" +
"#UPPGIFT 3101 AMC\r\n" +
"#UPPGIFT 3102 14494\r\n" +
"#UPPGIFT 3103 17099\r\n" +
"#UPPGIFT 3104 0\r\n" +
"#UPPGIFT 3105 2605\r\n" +
"#BLANKETTSLUT\r\n" +
"#FIL_SLUT\r\n"),
"""
#BLANKETT K4-2021P4
#IDENTITET 197903054524 20220426 133009
#UPPGIFT 3100 80
#UPPGIFT 3101 AEHR
#UPPGIFT 3102 11065
#UPPGIFT 3103 9785
#UPPGIFT 3104 1280
#UPPGIFT 3105 0
#UPPGIFT 3300 11065
#UPPGIFT 3301 9785
#UPPGIFT 3304 1280
#UPPGIFT 3305 0
#UPPGIFT 7014 1
#BLANKETTSLUT
#FIL_SLUT

"""),
new(
new[]
{
new Execution("USD", "AEHR", new DateTime(2021, 10, 06, 09, 45, 56), 80, 14.24, -1139.2, -1, 1140.2, 0),
new Execution("USD", "AEHR", new DateTime(2021, 10, 07, 13, 09, 43), -80, 16.13, 1290.4, -1.01610104, -1140.2, 149.183899),
new Execution("USD", "AMC", new DateTime(2021, 11, 23, 12, 46, 38), 50, 39.83, -1991.5d, -1, 1992.5, 0),
new Execution("USD", "AMC", new DateTime(2021, 11, 30, 11, 55, 26), -50, 33.8, 1690, -1.014569, -1992.5, -303.514569),
},
"#BLANKETT K4-2021P4\r\n" +
"#IDENTITET 197903054524 20220426 133009\r\n" +
"#UPPGIFT 3100 80\r\n" +
"#UPPGIFT 3101 AEHR\r\n" +
"#UPPGIFT 3102 11065\r\n" +
"#UPPGIFT 3103 9785\r\n" +
"#UPPGIFT 3104 1280\r\n" +
"#UPPGIFT 3105 0\r\n" +
"#BLANKETTSLUT\r\n" +
"#FIL_SLUT\r\n"),
"""
#BLANKETT K4-2021P4
#IDENTITET 197903054524 20220426 133009
#UPPGIFT 3100 50
#UPPGIFT 3101 AMC
#UPPGIFT 3102 14494
#UPPGIFT 3103 17099
#UPPGIFT 3104 0
#UPPGIFT 3105 2605
#UPPGIFT 3300 14494
#UPPGIFT 3301 17099
#UPPGIFT 3304 0
#UPPGIFT 3305 2605
#UPPGIFT 7014 1
#BLANKETTSLUT
#FIL_SLUT

"""),
new(
new[]
{
new Execution("USD", "AVGO", new DateTime(2021, 12, 10, 09, 36, 08), -10, 624.83, 6248.30, -1.03305633, -6247.26694367, 0),
new Execution("USD", "AVGO", new DateTime(2021, 12, 10, 09, 39, 30), 10, 632.37, -6323.7, -1, 6247.266944, -77.433055999999993d),
},
"#BLANKETT K4-2021P4\r\n" +
"#IDENTITET 197903054524 20220426 133009\r\n" +
"#UPPGIFT 3100 10\r\n" +
"#UPPGIFT 3101 AVGO\r\n" +
"#UPPGIFT 3102 53611\r\n" +
"#UPPGIFT 3103 54275\r\n" +
"#UPPGIFT 3104 0\r\n" +
"#UPPGIFT 3105 664\r\n" +
"#BLANKETTSLUT\r\n" +
"#FIL_SLUT\r\n"),
"""
#BLANKETT K4-2021P4
#IDENTITET 197903054524 20220426 133009
#UPPGIFT 3100 10
#UPPGIFT 3101 AVGO
#UPPGIFT 3102 53611
#UPPGIFT 3103 54275
#UPPGIFT 3104 0
#UPPGIFT 3105 664
#UPPGIFT 3300 53611
#UPPGIFT 3301 54275
#UPPGIFT 3304 0
#UPPGIFT 3305 664
#UPPGIFT 7014 1
#BLANKETTSLUT
#FIL_SLUT

"""),
new(
new[]
{
new Execution("USD", "NAKD", new DateTime(2021, 10, 14, 09, 41, 55), 4091, 0.69375407, -2838.1479, -30.6825, 2868.8304, 0),
new Execution("USD", "NAKD", new DateTime(2021, 10, 18, 09, 30, 01), -4091, 0.6616, 2706.6056, -28.377888689, -2867.096556904, -188.868845),
},
"#BLANKETT K4-2021P4\r\n" +
"#IDENTITET 197903054524 20220426 133009\r\n" +
"#UPPGIFT 3100 4091\r\n" +
"#UPPGIFT 3101 NAKD\r\n" +
"#UPPGIFT 3102 22983\r\n" +
"#UPPGIFT 3103 24604\r\n" +
"#UPPGIFT 3104 0\r\n" +
"#UPPGIFT 3105 1621\r\n" +
"#BLANKETTSLUT\r\n" +
"#FIL_SLUT\r\n"),
"""
#BLANKETT K4-2021P4
#IDENTITET 197903054524 20220426 133009
#UPPGIFT 3100 4091
#UPPGIFT 3101 NAKD
#UPPGIFT 3102 22983
#UPPGIFT 3103 24604
#UPPGIFT 3104 0
#UPPGIFT 3105 1621
#UPPGIFT 3300 22983
#UPPGIFT 3301 24604
#UPPGIFT 3304 0
#UPPGIFT 3305 1621
#UPPGIFT 7014 1
#BLANKETTSLUT
#FIL_SLUT

"""),
};

[TestCaseSource(nameof(Cases))]
Expand Down

0 comments on commit 24c0222

Please sign in to comment.