public void AddDataProviderCollection_NoExistingCollections_AddsCollectionConfig()
        {
            // Arrange
            var config = new DatabaseConfig
            {
                Collections = new List <CollectionConfig>()
            };

            var expected = new DatabaseConfig
            {
                Collections = new List <CollectionConfig>
                {
                    new CollectionConfig
                    {
                        CollectionName   = "name",
                        DataFileLocation = null,
                        DropFirst        = true,
                        DataProvider     = new TestDataProvider()
                    }
                }
            };

            // Act
            config.AddDataProviderCollection <object>("name", true, new TestDataProvider());

            // Assert
            Assert.Equal(expected, config, Comparers.DatabaseConfigComparer());
            Assert.NotNull(config.Collections[0].DataProvider);
            Assert.IsType <TestDataProvider>(config.Collections[0].DataProvider);
        }
        public void AddDataProviderCollection_WithNameThatAlreadyExists_ThrowsSettingsBuilderException()
        {
            // Arrange
            var config = new DatabaseConfig
            {
                Collections = new List <CollectionConfig>
                {
                    new CollectionConfig {
                        CollectionName = "name"
                    }
                }
            };

            // Act / Assert
            Assert.Throws <SettingsBuilderException>(
                () => config.AddDataProviderCollection <object>("name", true, new TestDataProvider()));
        }
        public void AddDataProviderCollection_ExisitngCollections_AddsAdditionalCollectionConfig()
        {
            // Arrange
            var config = new DatabaseConfig
            {
                Collections = new List <CollectionConfig>
                {
                    new CollectionConfig
                    {
                        CollectionName   = "name",
                        DataFileLocation = null,
                        DropFirst        = true,
                        DataProvider     = new TestDataProvider()
                    }
                }
            };

            var expected = new DatabaseConfig
            {
                Collections = new List <CollectionConfig>
                {
                    new CollectionConfig
                    {
                        CollectionName   = "name",
                        DataFileLocation = null,
                        DropFirst        = true,
                        DataProvider     = new TestDataProvider()
                    },
                    new CollectionConfig
                    {
                        CollectionName   = "name-2",
                        DataFileLocation = null,
                        DropFirst        = false,
                        DataProvider     = new TestDataProvider()
                    }
                }
            };

            // Act
            config.AddDataProviderCollection <object>("name-2", false, new TestDataProvider());

            // Assert
            Assert.Equal(expected, config, Comparers.DatabaseConfigComparer());
        }