Conversation
| # Course of c# | ||
|
|
||
| Please write your name and surname here No newline at end of file | ||
| ��������� ������� No newline at end of file |
There was a problem hiding this comment.
Можо каким-то другим редактором поддреживающим кодировку?
laba2/Program.cs
Outdated
| } | ||
| static double Fan(double x) | ||
| { | ||
| double a = 0.1; |
There was a problem hiding this comment.
a и b следует также вынести в параметры функции
laba2/Program.cs
Outdated
| double a = 0.1; | ||
| double b = 0.5; | ||
| double y; | ||
| y = ((a + (Math.Tan(b * x)) * (Math.Tan(b * x))) / (b + (1 / (Math.Tan(a * x))) * (1 / (Math.Tan(a * x))))); |
There was a problem hiding this comment.
Объедините объявление и присвоение
jskonst
left a comment
There was a problem hiding this comment.
Переместите код из Laba_2 в CourseApp - можно прямо в ProgramCS
test/UnitTest1.cs
Outdated
| public void Test1() | ||
| { | ||
| City ivanovo = new City(); | ||
| var res_country = ivanovo.Country; |
There was a problem hiding this comment.
А зачем вы временные переменные создаете? это как бы не обязательно
There was a problem hiding this comment.
А вот стиль названия с _ в имени - не принят - поправьте
test/UnitTest1.cs
Outdated
| Assert.Equal(9000, res_population); | ||
| Assert.Equal("�����", res_name); | ||
| } | ||
| [Fact] |
CourseApp/City.cs
Outdated
| } | ||
| } | ||
|
|
||
| public City() { Name = "Иваново"; Country = "Россия"; population = 316; } // 1 конструктор |
There was a problem hiding this comment.
Переиспользуйте конструктор - данный донструктор без параметров должен вызвать основной констурктор, передав ему все параметры
CourseApp/City.cs
Outdated
| { | ||
| population += pop; | ||
| } | ||
| public void Ueh() |
There was a problem hiding this comment.
Неее - вот первых - у какого города бы не выбрал метот - погибнет Иваново... Поэтому переделайет на общий случай - имя возьмите из свойств объекта
CourseApp.Tests/UnitTest1.cs
Outdated
|
|
||
| public class UnitTest1 | ||
| { | ||
| public object Assert { get; private set; } |
There was a problem hiding this comment.
Вот корень всего зла, зачем добавили? я понимаю что Studio предложила и согласились сгенерировать...
CourseApp.Tests/UnitTest1.cs
Outdated
| @@ -0,0 +1,61 @@ | |||
| namespace Test | |||
| { | |||
| using System; | |||
There was a problem hiding this comment.
это вроде бы как за пределы пространства имен, но если ругаться е будет, то ок
CourseApp.Tests/UnitTest1.cs
Outdated
| var rescountry = ivanovo.Country; | ||
| var respopulation = ivanovo.Population ; | ||
| var resname = ivanovo.Name; | ||
| Assert.Equal("������", rescountry); |
There was a problem hiding this comment.
можно сразу сравнивать с ivanovo.Country - зачем вам строчки выше?
| [Fact] | ||
| public void Test4() | ||
| { | ||
| var res = Program.Formula(0.1, 0.5, 0.15); |
There was a problem hiding this comment.
Эти тесты должны быть в отдельном файле
CourseApp/City.cs
Outdated
| Console.WriteLine($"Название: {Name} Страна: {Country} Популяция: {population}"); | ||
| } | ||
|
|
||
| public void Addpopulation(int pop) |
There was a problem hiding this comment.
правильее назвать AddPopulation - в camelCase - второе слово тоже сбольшой буквы
There was a problem hiding this comment.
у нас все таки CamelCase - AddPopulation а не AddPopulation
CourseApp/City.cs
Outdated
|
|
||
| public string Dead() | ||
| { | ||
| return $"Всё население города {Name} вымерло из-за аварии на АЭС."; |
There was a problem hiding this comment.
А если после вызова метода я спрошу про population?
Fixed problems with tests
|
|
||
| public string Name { get; set; } | ||
| { | ||
| public class City |
There was a problem hiding this comment.
Воу воу - сразу нет - 1 файл 1 класс
jskonst
left a comment
There was a problem hiding this comment.
Да и код не компилируется :( . А о чем мы договаривались - код в git'e как миимум компилируется :(
No description provided.