Ejemplo n.º 1
0
        public void GivenMarketingEventType_WhenAskingIsSameEventType_TheItShouldReturnCorrectResult()
        {
            // arrange
            MessageBaseImplementation message = new MessageBaseImplementation(EventType.Marketing, "offer");

            // act
            bool actual = message.IsEventType(EventType.Marketing);

            // assert
            actual.Should().BeTrue();
        }
Ejemplo n.º 2
0
        public void GivenHydratedObject_WhenAskingForUniqueIdentifier_TheItShouldReturnGuid()
        {
            // arrange
            MessageBaseImplementation message = new MessageBaseImplementation(EventType.Marketing, "offer");

            // act
            string actual = message.UniqueIdentifier();

            // assert
            Guid guid = Guid.Parse(actual);

            guid.Should().NotBeEmpty();
        }
Ejemplo n.º 3
0
        public void GivenHydratedObject_WhenAskingForEventData_TheItShouldReturnCorrectResult()
        {
            // arrange
            const string              need      = "offer";
            const EventType           eventType = EventType.Marketing;
            MessageBaseImplementation message   = new MessageBaseImplementation(eventType, need);

            // act
            EventData actual = message.AsEventData();

            // assert
            dynamic dynamicActual = JsonConvert.DeserializeObject <ExpandoObject>(Encoding.UTF8.GetString(actual.Body.Array));

            ((string)dynamicActual.eventType).Should().Be(eventType.ToString());
            ((string)dynamicActual.need).Should().Be(need);
            ((DateTime)dynamicActual.createdDateTime).Should().BeAfter(DateTime.UtcNow.AddMilliseconds(-500));
            ((string)dynamicActual.id).Should().HaveLength(36);
        }