public async Task CreateAsync_should_throw_on_null_args() { Func <Task <DesktopBackgroundSettings> > action = () => DesktopBackgroundSettings.CreateAsync(null); (await action.Should().ThrowExactlyAsync <ArgumentNullException>()).And.ParamName.Should() .Be("registryReadService"); }
public async Task CreateAsync_should_map_background_types_correctly() { var fakeRegistry = new FakeRegistryService(); var registryValueToBackgroundKinds = new Dictionary <int, DesktopBackgroundKind> { [0] = DesktopBackgroundKind.Picture, [1] = DesktopBackgroundKind.SolidColor, [2] = DesktopBackgroundKind.Slideshow, }; foreach (KeyValuePair <int, DesktopBackgroundKind> pair in registryValueToBackgroundKinds) { fakeRegistry.SetMockedValue( RegistryBaseKey.CurrentUser, @"Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers", "BackgroundType", pair.Key); DesktopBackgroundSettings settings = await DesktopBackgroundSettings.CreateAsync(fakeRegistry); settings.BackgroundKind.Should().Be(pair.Value); } }