Esempio n. 1
0
        public async Task AllAsyncShouldReturnCollectionOfMessagesAndOrderThem()
        {
            //Arrange
            Mapper.Initialize(config => config.AddProfile <AutoMapperProfile>());
            var db = this.Context;

            this.PopulateData(db);

            var messagesService  = new MessageService(db);
            var reseiverUserName = "******";

            // Act
            var result = await messagesService.AllAsync(reseiverUserName);

            // Assert
            result
            .Should()
            .Match(r => r.ElementAt(0).Id == 2 &&
                   r.ElementAt(1).Id == 1)
            .And
            .HaveCount(2);
        }