public void RepositoryReturnsChannelItemsFromDatabase() { var informationCollection = new MongoCollectionReturnsSpecificDocumentsStub(new List <InformationEntry> { new InformationEntry { InformationId = "Steam.de.Sims4" }, new InformationEntry { InformationId = "Nintendo.de.Zelda-Twilight-Princess" } }); var database = new MongoDatabaseSpy(new Dictionary <string, IMongoCollection <InformationEntry> > { { "information", informationCollection } }); var repository = new GetChannelMongoDatabaseRepository(database); var channel = repository.GetChannel(); var expectedInformationIds = new[] { "Steam.de.Sims4", "Nintendo.de.Zelda-Twilight-Princess" }; Assert.Equal( JsonConvert.SerializeObject(new Channel { InformationItemIds = expectedInformationIds }), JsonConvert.SerializeObject(channel) ); }
public void RepositorySelectsCollectionInformationFromDatabase() { var database = new MongoDatabaseSpy(); var repository = new GetChannelMongoDatabaseRepository(database); repository.GetChannel(); Assert.Equal("information", database.LastSelectedCollectionName); }
public GetChannelResponse GetChannel(string channelId) { var repository = new GetChannelMongoDatabaseRepository(this.GetMongoDatabase()); var interactor = new GetChannelInteractor(repository); var response = interactor.Execute(); response.ChannelId = channelId; return(response); }