public void WithDelimiter_CustomDelimiter_SetsCustomDelimiter()
        {
            var configurator = new TupleSerializerConfigurator();

            configurator.WithDelimiter(":");

            Assert.Equal(":", configurator._delimiter);
        }
        public void WithTupleTypes_EmptyList_DoesNotRegisterAnyTuples()
        {
            var configurator = new TupleSerializerConfigurator();

            configurator.WithTupleTypes(new List <Type>());

            Assert.Empty(configurator._tupleTypes);
        }
        public void WithAssemblies_EmptyList_DoesNotSetAnyAssemblies()
        {
            var configurator = new TupleSerializerConfigurator();

            configurator.WithAssemblies(null);

            Assert.Empty(configurator._assembliesToScan);
        }
        public void WithTupleTypes_ListWithTupleTypesAndNonTupleTypes_OnlyRegistersTuples()
        {
            var configurator = new TupleSerializerConfigurator();

            configurator.WithTupleTypes(new List <Type>
            {
                typeof(Tuple <string, string>), typeof(NotSupportedException)
            });

            Assert.Equal(1, configurator._tupleTypes.Count);
            Assert.True(configurator._tupleTypes.Contains(typeof(Tuple <string, string>)));
        }
        public void WithTupleTypes_ListWithAlreadyRegisteredTupleType_DoesNotReRegisterTupleType()
        {
            var configurator = new TupleSerializerConfigurator();

            configurator._tupleTypes.Add(typeof(Tuple <bool, bool>));

            configurator.WithTupleTypes(new List <Type>
            {
                typeof(Tuple <bool, bool>)
            });

            Assert.Equal(1, configurator._tupleTypes.Count);
            Assert.True(configurator._tupleTypes.Contains(typeof(Tuple <bool, bool>)));
        }
        public void WithTupleTypes_ListWithNonRegisteredTupleType_AdditivelyRegistersTupleType()
        {
            var configurator = new TupleSerializerConfigurator();

            configurator._tupleTypes.Add(typeof(Tuple <bool, bool>));

            configurator.WithTupleTypes(new List <Type>
            {
                typeof(Tuple <string, string>)
            });

            Assert.Equal(2, configurator._tupleTypes.Count);
            Assert.True(configurator._tupleTypes.Contains(typeof(Tuple <bool, bool>)));
        }
        public void WithAssemblies_EmptyList_DoesNotSetAnyAssemblies()
        {
            var configurator = new TupleSerializerConfigurator();

            configurator.WithAssemblies(null);

            Assert.Empty(configurator._assembliesToScan);
        }
        public void WithDelimiter_CustomDelimiter_SetsCustomDelimiter()
        {
            var configurator = new TupleSerializerConfigurator();

            configurator.WithDelimiter(":");

            Assert.Equal(":", configurator._delimiter);
        }
        public void WithTupleTypes_ListWithAlreadyRegisteredTupleType_DoesNotReRegisterTupleType()
        {
            var configurator = new TupleSerializerConfigurator();
            configurator._tupleTypes.Add(typeof(Tuple<bool, bool>));

            configurator.WithTupleTypes(new List<Type>
            {
                typeof(Tuple<bool,bool>)
            });

            Assert.Equal(1, configurator._tupleTypes.Count);
            Assert.True(configurator._tupleTypes.Contains(typeof(Tuple<bool, bool>)));
        }
        public void WithTupleTypes_ListWithNonRegisteredTupleType_AdditivelyRegistersTupleType()
        {
            var configurator = new TupleSerializerConfigurator();
            configurator._tupleTypes.Add(typeof(Tuple<bool, bool>));

            configurator.WithTupleTypes(new List<Type>
            {
                typeof(Tuple<string,string>)
            });

            Assert.Equal(2, configurator._tupleTypes.Count);
            Assert.True(configurator._tupleTypes.Contains(typeof(Tuple<bool, bool>)));
        }
        public void WithTupleTypes_ListWithTupleTypesAndNonTupleTypes_OnlyRegistersTuples()
        {
            var configurator = new TupleSerializerConfigurator();

            configurator.WithTupleTypes(new List<Type>
            {
                typeof(Tuple<string,string>), typeof(NotSupportedException)
            });

            Assert.Equal(1, configurator._tupleTypes.Count);
            Assert.True(configurator._tupleTypes.Contains(typeof(Tuple<string, string>)));
        }
        public void WithTupleTypes_EmptyList_DoesNotRegisterAnyTuples()
        {
            var configurator = new TupleSerializerConfigurator();

            configurator.WithTupleTypes(new List<Type>());

            Assert.Empty(configurator._tupleTypes);
        }