예제 #1
0
        public void IsAuthorized_ReturnsTrue()
        {
            var context    = MovieDbContext.InMemoryContext();
            var controller = new MoviesController(context);

            Assert.IsTrue(controller.BaseIsAuthorized(TableOperation.None, null));
        }
예제 #2
0
        public void CtorWithRepository_SetsTableRepository()
        {
            var context    = MovieDbContext.InMemoryContext();
            var controller = new MoviesController(context);

            Assert.IsNotNull(controller.TableRepository);
        }
예제 #3
0
        public void TableRepository_ThrowsIfSetNull()
        {
            var context    = MovieDbContext.InMemoryContext();
            var controller = new MoviesController(context);

            controller.TableRepository = null;
            Assert.Fail("ArgumentNullException expected");
        }
예제 #4
0
        public void TableRepository_ThrowsIfSetTwice()
        {
            var context    = MovieDbContext.InMemoryContext();
            var controller = new MoviesController(context);

            controller.TableRepository = new EntityTableRepository <Movie>(context);
            Assert.Fail("InvalidOperationException expected");
        }
예제 #5
0
        public void TableRepository_Roundtrips()
        {
            var context    = MovieDbContext.InMemoryContext();
            var controller = new MoviesController();

            controller.TableRepository = new EntityTableRepository <Movie>(context);
            Assert.IsNotNull(controller.TableRepository);
        }
예제 #6
0
        public void PrepareItemForStore_ReturnsSelf()
        {
            var context    = MovieDbContext.InMemoryContext();
            var controller = new MoviesController(context);
            var testItem   = new Movie()
            {
                Title = "foo"
            };

            Assert.AreEqual(testItem, controller.BasePrepareItemForStore(testItem));
        }