public IEnumerable <ParticipantLibraryItemDto> GetAll()
        {
            var query = new GetAllParticipantLibraryItemsQuery();

            library.Execute(query);
            return(query.Result);
        }
Пример #2
0
        public void ShouldReadAllParticipantLibraryItems()
        {
            var query = new GetAllParticipantLibraryItemsQuery();

            _piLibrary.Execute(query);
            var result = query.Result.ToList();

            //Assert
            result.Count.ShouldBe(2);
            var item1 = result.Single(x => x.NexusKey == pliItem1.NexusKey);

            item1.TypeKey.ShouldBe(pliType1.NexusKey);

            var item2 = result.Single(x => x.NexusKey == pliItem2.NexusKey);

            item2.TypeKey.ShouldBe(pliType2.NexusKey);
        }
Пример #3
0
        public void ShouldUpdateParticipantLibraryItem()
        {
            string randomGuidString = Guid.NewGuid().ToString();

            var getAllQuery = new GetAllParticipantLibraryItemsQuery();

            _piLibrary.Execute(getAllQuery);

            var plItemToUpdate = getAllQuery.Result.FirstOrDefault();

            if (plItemToUpdate != null)
            {
                var saveCommand = new SaveParticipantLibraryItemCommand()
                {
                    NexusKey    = plItemToUpdate.NexusKey,
                    Name        = PL_ITEM_1_NAME_UPDATED + randomGuidString,
                    DisplayName = plItemToUpdate.DisplayName,
                    DisplayCode = PL_ITEM_1_DISPLAY_CODE_UPDATED + randomGuidString,
                    Iso2Code    = plItemToUpdate.Iso2Code,
                    Iso3Code    = plItemToUpdate.Iso3Code,
                    TypeKey     = plItemToUpdate.TypeKey,
                };

                _piLibrary.Execute(saveCommand);

                //Assert
                var getItemQuery = new GetParticipantLibraryItemByKeyQuery(plItemToUpdate.NexusKey);
                _piLibrary.Execute(getItemQuery);
                var result = getItemQuery.Result;

                result.NexusKey.ShouldBe(plItemToUpdate.NexusKey);
                result.Name.ShouldBe(PL_ITEM_1_NAME_UPDATED + randomGuidString);
                result.DisplayCode.ShouldBe(PL_ITEM_1_DISPLAY_CODE_UPDATED + randomGuidString);
                result.Iso2Code.ShouldBe(plItemToUpdate.Iso2Code);
                result.TypeKey.ShouldBe(plItemToUpdate.TypeKey);
                result.TypeName.ShouldBe(plItemToUpdate.TypeName);
            }
        }
Пример #4
0
        public async Task ShouldPublishItemUpdatedEventWhenUpdatingItem()
        {
            string randomGuidString = Guid.NewGuid().ToString();

            var getAllQuery = new GetAllParticipantLibraryItemsQuery();

            _piLibrary.Execute(getAllQuery);

            var plItemToUpdate = getAllQuery.Result.FirstOrDefault();

            if (plItemToUpdate != null)
            {
                var saveCommand = new SaveParticipantLibraryItemCommand()
                {
                    NexusKey    = plItemToUpdate.NexusKey,
                    Name        = PL_ITEM_1_NAME_UPDATED + randomGuidString,
                    DisplayName = plItemToUpdate.DisplayName,
                    DisplayCode = PL_ITEM_1_DISPLAY_CODE_UPDATED + randomGuidString,
                    Iso2Code    = plItemToUpdate.Iso2Code,
                    Iso3Code    = plItemToUpdate.Iso3Code,
                    TypeKey     = plItemToUpdate.TypeKey,
                };

                _piLibrary.Execute(saveCommand);
                await _updatedPublishedMessageReceived;

                //Assert
                var publishedMessage = _updatedPublishedMessageReceived.Result.Message;
                publishedMessage.ShouldBeAssignableTo <IParticipantLibraryItemUpdated>();
                publishedMessage.NexusKey.ShouldBe(plItemToUpdate.NexusKey);
                publishedMessage.Name.ShouldBe(PL_ITEM_1_NAME_UPDATED + randomGuidString);
                publishedMessage.DisplayCode.ShouldBe(PL_ITEM_1_DISPLAY_CODE_UPDATED + randomGuidString);
                publishedMessage.Iso2Code.ShouldBe(plItemToUpdate.Iso2Code);
                publishedMessage.TypeKey.ShouldBe(plItemToUpdate.TypeKey);
                publishedMessage.SentDate.ShouldBeInRange(DateTime.UtcNow.AddMinutes(-1), DateTime.UtcNow);
            }
        }