public void DeleteConfiguration_ShouldThrowException_WhenConfigurationExistsButVersionDoesNot() { // arrange var key = _fixture.Create <string>(); var version = _fixture.Create <Version>(); var dataType = _fixture.Create <ValueType>().ToString(); var wrongVersion = _fixture.Create <Version>(); var store = new Dictionary <string, Tuple <string, IDictionary <Version, IList <Tuple <Guid, int, string, IEnumerable <string> > > > > > { { key, new Tuple <string, IDictionary <Version, IList <Tuple <Guid, int, string, IEnumerable <string> > > > >( dataType, new Dictionary <Version, IList <Tuple <Guid, int, string, IEnumerable <string> > > > { { version, new List <Tuple <Guid, int, string, IEnumerable <string> > >() } }) } }; _sut = new InMemoryConfigurationRepository(store); Func <Task> exceptionThrower = async() => await _sut .DeleteConfigurationVersion(key, wrongVersion) .ConfigureAwait(false); // act/assert exceptionThrower.ShouldThrow <ArgumentException>(); }
public async Task DeleteConfiguration_ShouldDeleteConfiguration_WhenConfigurationExists() { // arrange var key = _fixture.Create <string>(); var version = _fixture.Create <Version>(); var dataType = _fixture.Create <ValueType>().ToString(); var store = new Dictionary <string, Tuple <string, IDictionary <Version, IList <Tuple <Guid, int, string, IEnumerable <string> > > > > > { { key, new Tuple <string, IDictionary <Version, IList <Tuple <Guid, int, string, IEnumerable <string> > > > >( dataType, new Dictionary <Version, IList <Tuple <Guid, int, string, IEnumerable <string> > > > { { version, new List <Tuple <Guid, int, string, IEnumerable <string> > >() } }) } }; _sut = new InMemoryConfigurationRepository(store); // act await _sut .DeleteConfigurationVersion(key, version) .ConfigureAwait(false); // assert store[key] .Item2 .ContainsKey(version) .Should() .BeFalse(); }