Правка автотеста по результатам ревью

This commit is contained in:
Olga Nemt 2024-09-12 13:05:58 +05:00
parent 6007fb181c
commit 95dfef6219

View File

@ -245,47 +245,25 @@ public class MessageServiceTest
Assert.Equal(6, result.Count()); Assert.Equal(6, result.Count());
var messageStat_1_1 = result AssertStatByEvent(result, 1, events[0], 3);
.Where(x => x.IdWell == 1) AssertStatByEvent(result, 1, events[1], 3);
.Where(x => x.IdCategory == 1) AssertStatByEvent(result, 1, events[2], 3);
.Where(x => x.MessageTemplate == "Шаблон сообщения 1 категории 1") AssertStatByEvent(result, 1, events[3], 2);
.Single(); AssertStatByEvent(result, 1, events[4], 2);
Assert.Equal(3, messageStat_1_1.MessagesCount); AssertStatByEvent(result, 2, events[5], 3);
}
var messageStat_1_2 = result private void AssertStatByEvent(IEnumerable<StatCriticalMessageDto> result, int idWell, TelemetryEventDto eventDto, int count)
.Where(x => x.IdWell == 1) {
.Where(x => x.IdCategory == 1) var eventStats = result
.Where(x => x.MessageTemplate == "Шаблон сообщения 2 категории 1") .Where(x => x.IdWell == idWell)
.Single(); .Where(x => x.IdCategory == eventDto.IdCategory)
Assert.Equal(3, messageStat_1_2.MessagesCount); .Where(x => x.MessageTemplate == eventDto.MessageTemplate)
.ToArray();
var messageStat_1_3 = result Assert.Single(eventStats);
.Where(x => x.IdWell == 1) var eventStat = eventStats.First();
.Where(x => x.IdCategory == 1) Assert.Equal(count, eventStat.MessagesCount);
.Where(x => x.MessageTemplate == "Шаблон сообщения 3 категории 1")
.Single();
Assert.Equal(3, messageStat_1_3.MessagesCount);
var messageStat_2_2 = result
.Where(x => x.IdWell == 1)
.Where(x => x.IdCategory == 2)
.Where(x => x.MessageTemplate == "Шаблон сообщения 2 категории 2")
.Single();
Assert.Equal(2, messageStat_2_2.MessagesCount);
var messageStat_2_1 = result
.Where(x => x.IdWell == 1)
.Where(x => x.IdCategory == 2)
.Where(x => x.MessageTemplate == "Шаблон сообщения 1 категории 2")
.Single();
Assert.Equal(2, messageStat_2_1.MessagesCount);
var messageStat_3_1 = result
.Where(x => x.IdWell == 2)
.Where(x => x.IdCategory == 3)
.Where(x => x.MessageTemplate == "Шаблон сообщения 1 категории 3")
.Single();
Assert.Equal(3, messageStat_3_1.MessagesCount);
} }