Пример #1
0
        public void MappingCollectionSequentialProvider(IMapping map)
        {
            List <int> data = new List <int>()
            {
                1, 2, 3, 4
            };
            var providers = map.GetFieldsWithProviders;
            var result    = map.Collection("Number", data);
            var provider  = providers.FirstOrDefault();

            Assert.Equal(map, result);
            Assert.Equal("Number", provider.Key);
            Assert.Equal(ProviderType.Sequential, provider.Value.Type);
            Assert.Equal(typeof(int), provider.Value.TType);
            Assert.Equal(data, ((CollectionProvider <int>)provider.Value).Collection);
        }
Пример #2
0
        public void MappingCollectionRandomProvider(IMapping map)
        {
            List <int> data = new List <int>()
            {
                1, 2, 3, 4
            };
            var providers = map.GetFieldsWithProviders;
            var result    = map.Collection("Number", data, ProviderType.Random);
            var provider  = providers.FirstOrDefault();

            Assert.Equal(map, result);
            Assert.Equal("Number", provider.Key);
            Assert.Equal(ProviderType.Random, provider.Value.Type);
            Assert.Equal(typeof(int), provider.Value.TType);

            Assert.All(((CollectionProvider <int>)provider.Value).Collection, i => {
                Assert.Contains(i, data);
            });

            //Assert.Equal(data, ((CollectionProvider<int>)provider.Value).Collection);
        }