public void GetRepository_GivenRepositoryType_ReturnsInstanceOfCorrectRepository(CosmosCollectionType cosmosRepositoryType, string repositoryTypeName) { //Arrange CosmosCollectionType repositoryType = cosmosRepositoryType; IServiceProvider serviceProvider = CreateServiceProvider(); CosmosDbScalingRepositoryProvider scalingRepositoryProvider = new CosmosDbScalingRepositoryProvider(serviceProvider); //Act ICosmosDbScalingRepository scalingRepository = scalingRepositoryProvider.GetRepository(repositoryType); //Assert //AB: using gettype and name rather than assignable tp because ncrunch throws a wobbly scalingRepository .GetType() .Name .Should() .Be(repositoryTypeName); }
public void GetRepository_GivenRepositoryTypeIsNotValid_ThrowsArgumentException() { //Arrange CosmosCollectionType repositoryType = (CosmosCollectionType)42; IServiceProvider serviceProvider = CreateServiceProvider(); CosmosDbScalingRepositoryProvider scalingRepositoryProvider = new CosmosDbScalingRepositoryProvider(serviceProvider); //Act Action test = () => scalingRepositoryProvider.GetRepository(repositoryType); //Assert test .Should() .ThrowExactly <ArgumentException>() .Which .Message .Should() .Be("Invalid repository type provided"); }