Skip to content

Commit e8f4130

Browse files
committed
Small changes, added initial documentation progress
1 parent 59b20d1 commit e8f4130

22 files changed

+2721
-96
lines changed

CryptoStatsSource/Tests/Tests.csproj

Lines changed: 0 additions & 22 deletions
This file was deleted.

Database/SqlKataDatabase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
namespace Database
77
{
8+
/**
9+
* Wraps over a SQL database connection and adds SqlKata extensions via QueryFactory
10+
*/
811
public class SqlKataDatabase : IDisposable
912
{
1013
private readonly QueryFactory _queryFactory;

Repository/IRepository.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Repository
44
{
5+
// TODO comments
56
public interface IRepository<T>
67
{
78
public object ToRow(T entry);

Repository/SqlKataMarketOrderRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public override MarketOrder FromRow(dynamic d)
3131
throw new SqlKataRepositoryException($"Failed to parse currency {d.currency}");
3232
}
3333

34-
return new(currency, d.filled_price, d.fee, d.size, Utils.Utils.UnixTimeStampToDateTime(d.date), d.buy > 0,
34+
return new(currency, d.filled_price, d.fee, d.size, Utils.DateUtils.UnixTimeStampToDateTime(d.date), d.buy > 0,
3535
0, 0);
3636
}
3737
}

Repository/SqlKataRepository.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Repository
88
{
9+
// Implements IRepository using a SqlKataDatabase
910
public abstract class SqlKataRepository<T> : IRepository<T>
1011
{
1112
protected readonly SqlKataDatabase Db;

Tests/Integration/Repository/MarketOrderTest.cs

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -40,72 +40,5 @@ public MarketOrderRepositoryTest(SqlKataMarketOrderRepositoryFixture marketOrder
4040
{
4141
this._marketOrderRepositoryFixture = marketOrderRepositoryFixture;
4242
}
43-
44-
// [Fact]
45-
// public void Add_ReturnsNonZeroId()
46-
// {
47-
// // arrange
48-
// var marketOrder =
49-
// new MarketOrder(Currency.Czk, 10000, 10, new Decimal(0.1), Utils.Utils.UnixTimeStampToDateTime(1618648965),
50-
// true, PortfolioEntryId: _marketOrderRepositoryFixture.DefaultPortfolioId);
51-
52-
// // act
53-
// int id = _marketOrderRepositoryFixture.MarketOrderRepository.Add(marketOrder);
54-
// var marketOrderLoaded = _marketOrderRepositoryFixture.MarketOrderRepository.Get(id);
55-
56-
// marketOrder = marketOrder with
57-
// {
58-
// Id = id
59-
// };
60-
61-
// // assert
62-
// Assert.True(id > 0);
63-
// Assert.Equal(marketOrder, marketOrderLoaded);
64-
// }
65-
66-
// [Fact]
67-
// public void Added_And_Get_AreEqual()
68-
// {
69-
// // arrange
70-
// var portfolio = new Portfolio("My new portfolio", "Lorem ipsum dolor sit amet");
71-
72-
// // act
73-
// int id = _marketOrderRepositoryFixture.PortfolioRepository.Add(portfolio);
74-
// var loaded = _marketOrderRepositoryFixture.PortfolioRepository.Get(id);
75-
// portfolio = portfolio with
76-
// {
77-
// Id = loaded.Id
78-
// };
79-
80-
// // assert
81-
// Assert.True(id > 0);
82-
// Assert.Equal(portfolio, loaded);
83-
// }
84-
85-
// [Fact]
86-
// public void AddUpdate_Updates()
87-
// {
88-
// // arrange
89-
// var template = new Portfolio("My new portfolio", "Lorem ipsum dolor sit amet");
90-
91-
// // act
92-
// int firstId = _marketOrderRepositoryFixture.PortfolioRepository.Add(template);
93-
// int secondId = _marketOrderRepositoryFixture.PortfolioRepository.Add(template);
94-
// var secondPortfolio = template with
95-
// {
96-
// Id = secondId
97-
// };
98-
// var firstPortfolio = template with
99-
// {
100-
// // update the first entry
101-
// Id = firstId,
102-
// // change it's name
103-
// Name = "Foo Portfolio"
104-
// };
105-
// _marketOrderRepositoryFixture.PortfolioRepository.Update(firstPortfolio);
106-
107-
// Assert.Equal(firstPortfolio, _marketOrderRepositoryFixture.PortfolioRepository.Get(firstPortfolio.Id));
108-
// Assert.Equal(secondPortfolio, _marketOrderRepositoryFixture.PortfolioRepository.Get(secondPortfolio.Id));
109-
// }
11043
}
11144
}

Tests/Integration/Repository/PortfolioEntryTest.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ public SqlKataPortfolioEntryRepositoryFixture()
2424
this.PortfolioRepository = new(db);
2525
this.PortfolioEntryRepository = new(db);
2626
DefaultPortfolioId = PortfolioRepository.Add(new("Foo", "Bar"));
27-
foreach (var portfolio in PortfolioRepository.All())
28-
{
29-
Console.WriteLine(portfolio);
30-
}
3127
}
3228

3329
public void Dispose()

Utils/Class1.cs renamed to Utils/DateUtils.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
namespace Utils
44
{
5-
public static class Utils
5+
public static class DateUtils
66
{
7+
/**
8+
* Converts unix timestamp to a DateTime object
9+
*/
710
public static DateTime UnixTimeStampToDateTime(double unixTimeStamp)
811
{
912
// Unix timestamp is seconds past epoch

WebFrontend/Data/WeatherForecastService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public async Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
2626

2727
public void Dispose()
2828
{
29-
Console.WriteLine("Disposin foreccast...");
29+
Console.WriteLine("Disposing forecast...");
3030
}
3131
}
3232
}

WebFrontend/data.db

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)