Beispiel #1
0
            public void WillThrowWhenCuratedFeedDoesNotExist()
            {
                var cmd = new TestableDeleteCuratedPackageCommand();

                cmd.StubCuratedFeedByKeyQry
                .Setup(stub => stub.Execute(It.IsAny <int>(), It.IsAny <bool>()))
                .Returns((CuratedFeed)null);

                Assert.Throws <InvalidOperationException>(() => cmd.Execute(
                                                              42,
                                                              0));
            }
Beispiel #2
0
            public void WillThrowWhenCuratedPackageDoesNotExist()
            {
                var cmd = new TestableDeleteCuratedPackageCommand();

                cmd.StubCuratedFeed.Packages = new[] { new CuratedPackage()
                                                       {
                                                           Key = 0
                                                       } };

                Assert.Throws <InvalidOperationException>(() => cmd.Execute(
                                                              0,
                                                              1066));
            }
Beispiel #3
0
            public void WillDeleteTheCuratedPackage()
            {
                var cmd = new TestableDeleteCuratedPackageCommand();
                var stubCuratedPackage = new CuratedPackage {
                    Key = 1066
                };

                cmd.StubCuratedFeed.Packages = new[] { stubCuratedPackage };

                cmd.Execute(
                    0,
                    1066);

                cmd.StubCuratedPackageDbSet.Verify(stub => stub.Remove(stubCuratedPackage));
                cmd.StubEntitiesContext.Verify(stub => stub.SaveChanges());
            }