aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/messagebus/message_status_counter_ut.cpp
blob: 959865132968ad3ddab0f7c297ffe0e39eaf165c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <library/cpp/testing/unittest/registar.h>

#include "message_status_counter.h"

#include <library/cpp/messagebus/monitoring/mon_proto.pb.h>

using namespace NBus;
using namespace NBus::NPrivate;

Y_UNIT_TEST_SUITE(MessageStatusCounter) {
    Y_UNIT_TEST(MessageStatusConversion) {
        const ::google::protobuf::EnumDescriptor* descriptor =
            TMessageStatusRecord_EMessageStatus_descriptor();

        for (int i = 0; i < MESSAGE_STATUS_COUNT; i++) {
            const ::google::protobuf::EnumValueDescriptor* valueDescriptor =
                descriptor->FindValueByName(ToString((EMessageStatus)i));
            UNIT_ASSERT_UNEQUAL(valueDescriptor, nullptr);
            UNIT_ASSERT_EQUAL(valueDescriptor->number(), i);
        }
        UNIT_ASSERT_EQUAL(MESSAGE_STATUS_COUNT, descriptor->value_count());
    }
}