forked from ddrilling/AsbCloudServer
Правка автотеста по результатам ревью
This commit is contained in:
parent
6007fb181c
commit
95dfef6219
@ -245,47 +245,25 @@ public class MessageServiceTest
|
||||
|
||||
Assert.Equal(6, result.Count());
|
||||
|
||||
var messageStat_1_1 = result
|
||||
.Where(x => x.IdWell == 1)
|
||||
.Where(x => x.IdCategory == 1)
|
||||
.Where(x => x.MessageTemplate == "Шаблон сообщения 1 категории 1")
|
||||
.Single();
|
||||
Assert.Equal(3, messageStat_1_1.MessagesCount);
|
||||
AssertStatByEvent(result, 1, events[0], 3);
|
||||
AssertStatByEvent(result, 1, events[1], 3);
|
||||
AssertStatByEvent(result, 1, events[2], 3);
|
||||
AssertStatByEvent(result, 1, events[3], 2);
|
||||
AssertStatByEvent(result, 1, events[4], 2);
|
||||
AssertStatByEvent(result, 2, events[5], 3);
|
||||
}
|
||||
|
||||
var messageStat_1_2 = result
|
||||
.Where(x => x.IdWell == 1)
|
||||
.Where(x => x.IdCategory == 1)
|
||||
.Where(x => x.MessageTemplate == "Шаблон сообщения 2 категории 1")
|
||||
.Single();
|
||||
Assert.Equal(3, messageStat_1_2.MessagesCount);
|
||||
private void AssertStatByEvent(IEnumerable<StatCriticalMessageDto> result, int idWell, TelemetryEventDto eventDto, int count)
|
||||
{
|
||||
var eventStats = result
|
||||
.Where(x => x.IdWell == idWell)
|
||||
.Where(x => x.IdCategory == eventDto.IdCategory)
|
||||
.Where(x => x.MessageTemplate == eventDto.MessageTemplate)
|
||||
.ToArray();
|
||||
|
||||
var messageStat_1_3 = result
|
||||
.Where(x => x.IdWell == 1)
|
||||
.Where(x => x.IdCategory == 1)
|
||||
.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);
|
||||
Assert.Single(eventStats);
|
||||
var eventStat = eventStats.First();
|
||||
Assert.Equal(count, eventStat.MessagesCount);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user