-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Homework 3 #3
base: main
Are you sure you want to change the base?
Homework 3 #3
Conversation
} | ||
|
||
[HttpGet("from/{fromTime}/to/{toTime}/percentiles/{percentile}")] | ||
public IActionResult GetMetricsByPercentileFromAgent([FromRoute] DateTime fromTime, [FromRoute] DateTime toTime, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ЗДесь тоже можно DateTimeOffset по идее
foreach (var metric in metrics) | ||
{ | ||
response.Metrics.Add(new CpuMetricDto | ||
{ Time = (DateTime)(UNIX.AddSeconds(metric.Time.TotalSeconds)), Value = metric.Value, Id = metric.Id }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Стоит Time тоже сделать DateTimeOffset а преобразовывать через стандартные методы этого класса.
|
||
namespace MetricsManager | ||
{ | ||
public class WeatherForecast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Этому классу давно пора умереть. Наш проект развивается и убивание этого класса - часть рефакторинга
public class CpuControllerUnitTests | ||
{ | ||
private CpuMetricsController controller; | ||
private Mock<IRepository<CpuMetric>> mock; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_contoller, _mock
{ | ||
private CpuMetricsController controller; | ||
private Mock<IRepository<CpuMetric>> mock; | ||
private readonly ILogger<CpuMetricsController> _logger; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не нашел, где инициализируется логгер. а ведь его тоже надо мОчить тут
private Mock<IRepository<CpuMetric>> mock; | ||
private readonly ILogger<CpuMetricsController> _logger; | ||
|
||
public CpuControllerUnitTests() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если контроллер называется CpuMetricsController, то тесты к нему принято называть CpuMetricsControllerTests. Разумеется если назвать их abcf все будет работать, но.... вобщем советую внимательно относится ко всем именования
No description provided.