Exemple #1
0
        public async void GetProduct_ShouldReturnProductWithSameID()
        {
            var context = new TestAlienzApiContext();

            context.Levels.Add(GetDemoLevel());

            var controller = new LevelsController(context);
            var result     = await controller.GetLevel(3) as OkNegotiatedContentResult <Level>;

            Assert.IsNotNull(result);
            Assert.AreEqual(3, result.Content.Id);
        }
Exemple #2
0
        public void GetProducts_ShouldReturnAllProducts()
        {
            var context = new TestAlienzApiContext();

            context.Levels.Add(new Level {
                Id = 1, World = 1, SequenceInWorld = 1
            });
            context.Levels.Add(new Level {
                Id = 2, World = 1, SequenceInWorld = 2
            });
            context.Levels.Add(new Level {
                Id = 3, World = 1, SequenceInWorld = 3
            });

            var controller = new LevelsController(context);
            var result     = controller.GetLevels() as TestLevelDbSet;

            Assert.IsNotNull(result);
            Assert.AreEqual(3, result.Local.Count);
        }