Пример #1
0
        public void TestCollectionToNonThreadSafeCollectionWithNull()
        {
            IEnumerable <Protocol.Models.MetadataItem> collection = null;
            IEnumerable <MetadataItem> result = UtilitiesInternal.CollectionToNonThreadSafeCollection(
                collection,
                objectCreationFunc: o => new MetadataItem(o));

            Assert.Null(result);
        }
Пример #2
0
        public void TestCollectionToNonThreadSafeCollectionOneItem()
        {
            const string metadataKey   = "Test";
            const string metadataValue = "Result";

            IEnumerable <Protocol.Models.MetadataItem> collection = new List <Protocol.Models.MetadataItem>()
            {
                new Protocol.Models.MetadataItem(metadataKey, metadataValue)
            };


            IEnumerable <MetadataItem> result = UtilitiesInternal.CollectionToNonThreadSafeCollection(
                collection,
                objectCreationFunc: o => new MetadataItem(o));

            Assert.NotNull(result);
            Assert.Equal(1, result.Count());

            MetadataItem protoItem = result.First();

            Assert.Equal(metadataKey, protoItem.Name);
            Assert.Equal(metadataValue, protoItem.Value);
        }