Skip to content
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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Homework 3 #3

wants to merge 10 commits into from

Conversation

Iamflip
Copy link
Owner

@Iamflip Iamflip commented Mar 26, 2021

No description provided.

}

[HttpGet("from/{fromTime}/to/{toTime}/percentiles/{percentile}")]
public IActionResult GetMetricsByPercentileFromAgent([FromRoute] DateTime fromTime, [FromRoute] DateTime toTime,

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 });

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

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;

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;

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()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если контроллер называется CpuMetricsController, то тесты к нему принято называть CpuMetricsControllerTests. Разумеется если назвать их abcf все будет работать, но.... вобщем советую внимательно относится ко всем именования

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants