public async Task WillThrowWhenCuratedFeedDoesNotExist()
            {
                var svc = new TestableCuratedFeedService();

                await Assert.ThrowsAsync<ArgumentNullException>(
                    async () => await svc.CreatedCuratedPackageAsync(
                        null,
                        svc.StubPackageRegistration));
            }
            public async Task WillThrowWhenPackageRegistrationDoesNotExist()
            {
                var svc = new TestableCuratedFeedService();

                await Assert.ThrowsAsync <ArgumentNullException>(
                    async() => await svc.CreatedCuratedPackageAsync(
                        svc.StubCuratedFeed,
                        null));
            }
            public async Task WillSaveTheEntityChanges()
            {
                var svc = new TestableCuratedFeedService();

                await svc.CreatedCuratedPackageAsync(
                    svc.StubCuratedFeed,
                    svc.StubPackageRegistration,
                    false,
                    true,
                    "theNotes");

                svc.StubCuratedPackageRepository.Verify(stub => stub.InsertOnCommit(It.IsAny <CuratedPackage>()));
                svc.StubCuratedPackageRepository.Verify(stub => stub.CommitChangesAsync());
            }
            public async Task WillReturnTheCreatedCuratedPackage()
            {
                var svc = new TestableCuratedFeedService();

                svc.StubPackageRegistration.Key = 1066;

                var curatedPackage = await svc.CreatedCuratedPackageAsync(
                    svc.StubCuratedFeed,
                    svc.StubPackageRegistration,
                    false,
                    true,
                    "theNotes");

                Assert.Equal(1066, curatedPackage.PackageRegistrationKey);
                Assert.Equal(false, curatedPackage.Included);
                Assert.Equal(true, curatedPackage.AutomaticallyCurated);
                Assert.Equal("theNotes", curatedPackage.Notes);
            }
            public async Task WillAddANewCuratedPackageToTheCuratedFeed()
            {
                var svc = new TestableCuratedFeedService();

                svc.StubPackageRegistration.Key = 1066;

                await svc.CreatedCuratedPackageAsync(
                    svc.StubCuratedFeed,
                    svc.StubPackageRegistration,
                    false,
                    true,
                    "theNotes");

                var curatedPackage = svc.StubCuratedFeed.Packages.First();

                Assert.Equal(1066, curatedPackage.PackageRegistrationKey);
                Assert.False(curatedPackage.Included);
                Assert.True(curatedPackage.AutomaticallyCurated);
                Assert.Equal("theNotes", curatedPackage.Notes);
            }
            public async Task WillAddANewCuratedPackageToTheCuratedFeed()
            {
                var svc = new TestableCuratedFeedService();
                svc.StubPackageRegistration.Key = 1066;

                await svc.CreatedCuratedPackageAsync(
                    svc.StubCuratedFeed,
                    svc.StubPackageRegistration,
                    false,
                    true,
                    "theNotes");

                var curatedPackage = svc.StubCuratedFeed.Packages.First();
                Assert.Equal(1066, curatedPackage.PackageRegistrationKey);
                Assert.Equal(false, curatedPackage.Included);
                Assert.Equal(true, curatedPackage.AutomaticallyCurated);
                Assert.Equal("theNotes", curatedPackage.Notes);
            }
            public async Task WillSaveTheEntityChanges()
            {
                var svc = new TestableCuratedFeedService();

                await svc.CreatedCuratedPackageAsync(
                    svc.StubCuratedFeed,
                    svc.StubPackageRegistration,
                    false,
                    true,
                    "theNotes");

                svc.StubCuratedPackageRepository.Verify(stub => stub.InsertOnCommit(It.IsAny<CuratedPackage>()));
                svc.StubCuratedPackageRepository.Verify(stub => stub.CommitChangesAsync());
            }