public void ShouldUpdateParticipantLibraryItem()
        {
            var saveCommand = new SaveParticipantLibraryItemCommand()
            {
                NexusKey    = pliItem1.NexusKey,
                Name        = PL_ITEM_1_NAME_UPDATED,
                DisplayCode = PL_ITEM_1_DISPLAY_CODE_UPDATED,
                TypeKey     = pliType2.NexusKey,
            };

            _piLibrary.Execute(saveCommand);

            //Assert
            var query = new GetParticipantLibraryItemByKeyQuery()
            {
                Key = pliItem1.NexusKey
            };

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

            result.NexusKey.ShouldBe(pliItem1.NexusKey);
            result.Name.ShouldBe(PL_ITEM_1_NAME_UPDATED);
            result.DisplayCode.ShouldBe(PL_ITEM_1_DISPLAY_CODE_UPDATED);
            result.Iso2Code.ShouldBe(pliItem1.Iso2Code);
            result.TypeKey.ShouldBe(pliType2.NexusKey);
            result.TypeName.ShouldBe(pliType2.Name);
        }
        public ParticipantLibraryItemDto GetByKey(Guid key)
        {
            var query = new GetParticipantLibraryItemByKeyQuery(key);

            library.Execute(query);
            return(query.Result);
        }
Beispiel #3
0
        public void ShouldReadParticipantLibraryItemByKey()
        {
            var query = new GetParticipantLibraryItemByKeyQuery()
            {
                Key = pliItem1.NexusKey
            };

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

            //Assert
            result.NexusKey.ShouldBe(pliItem1.NexusKey);
            result.Name.ShouldBe(PL_ITEM_1_NAME);
            result.TypeKey.ShouldBe(pliType1.NexusKey);
            result.TypeName.ShouldBe(TYPE_1_NAME);
        }
Beispiel #4
0
        public async Task ShouldCreateParticipantLibraryItemAndPublishMessage()
        {
            var randomGuid = Guid.NewGuid();

            var saveCommand = new SaveParticipantLibraryItemCommand()
            {
                NexusKey    = randomGuid,
                Name        = PL_ITEM_1_NAME + randomGuid.ToString(),
                DisplayName = randomGuid.ToString(),
                DisplayCode = PL_ITEM_1_DISPLAY_CODE + randomGuid.ToString(),
                Iso2Code    = randomGuid.ToString(),
                Iso3Code    = randomGuid.ToString(),
                TypeKey     = pliType1.NexusKey,
            };

            _piLibrary.Execute(saveCommand);
            await _createdPublishedMessageReceived;

            //Assert published message
            var publishedMessage = _createdPublishedMessageReceived.Result.Message;

            publishedMessage.ShouldBeAssignableTo <IParticipantLibraryItemCreated>();
            publishedMessage.NexusKey.ShouldBe(randomGuid);
            publishedMessage.Name.ShouldBe(PL_ITEM_1_NAME + randomGuid.ToString());
            publishedMessage.DisplayCode.ShouldBe(PL_ITEM_1_DISPLAY_CODE + randomGuid.ToString());
            publishedMessage.Iso2Code.ShouldBe(randomGuid.ToString());
            publishedMessage.TypeKey.ShouldBe(pliType1.NexusKey);
            publishedMessage.SentDate.ShouldBeInRange(DateTime.UtcNow.AddMinutes(-1), DateTime.UtcNow);

            //Assert
            var getItemQuery = new GetParticipantLibraryItemByKeyQuery(randomGuid);

            _piLibrary.Execute(getItemQuery);
            var result = getItemQuery.Result;

            result.NexusKey.ShouldBe(randomGuid);
            result.Name.ShouldBe(PL_ITEM_1_NAME + randomGuid.ToString());
            result.DisplayCode.ShouldBe(PL_ITEM_1_DISPLAY_CODE + randomGuid.ToString());
            result.Iso2Code.ShouldBe(randomGuid.ToString());
            result.TypeKey.ShouldBe(pliType1.NexusKey);
            result.TypeName.ShouldBe(pliType1.Name);
        }
Beispiel #5
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);
            }
        }