public void Match_unchanged_updated_missing_and_removed_price_episodes( List <PriceEpisode> priceEpisodes, string leftOverPriceEpisodeId, PriceEpisodeStatusCalculator sut) { var currentPriceEpisodes = new[] { new CurrentPriceEpisode //unchanged { PriceEpisodeIdentifier = priceEpisodes[1].Identifier, AgreedPrice = priceEpisodes[1].AgreedPrice, }, new CurrentPriceEpisode //updated { PriceEpisodeIdentifier = priceEpisodes[2].Identifier, AgreedPrice = priceEpisodes[2].AgreedPrice + 1, }, new CurrentPriceEpisode //removed { PriceEpisodeIdentifier = leftOverPriceEpisodeId, }, }; var r = sut.Calculate(currentPriceEpisodes, priceEpisodes); r.Should().BeEquivalentTo( (priceEpisodes[0].Identifier, PriceEpisodeStatus.New), (priceEpisodes[1].Identifier, PriceEpisodeStatus.New), (priceEpisodes[2].Identifier, PriceEpisodeStatus.Updated), (leftOverPriceEpisodeId, PriceEpisodeStatus.Removed) ); }
private static List <(string identifier, PriceEpisodeStatus status)> CalculatePriceEpisodeStatus( IEnumerable <DataLockEvent> dataLocks, IEnumerable <CurrentPriceEpisode> currentPriceEpisodes) { var calculator = new PriceEpisodeStatusCalculator(); var changes = calculator.Calculate(currentPriceEpisodes, dataLocks.SelectMany(x => x.PriceEpisodes)); return(changes); }