Esempio n. 1
0
        public void RegionsCreateReturnsView()
        {
            //Arrange

            //Act
            var result = _regionsControllerTest.Create() as ViewResult;

            //Assert
            Assert.IsNotNull(result);
        }
Esempio n. 2
0
        public void CreateMethodTest()
        {
            var options = new DbContextOptionsBuilder <MContext>()
                          .UseInMemoryDatabase(databaseName: "DB")
                          .Options;
            var controller = new RegionsController(new MContext(options));

            using (var context = new MContext(options))
            {
                context.Regions.Add(new Regions());
                context.SaveChanges();
            }

            using (var context = new MContext(options))
            {
                var result = controller.Create(new Regions());
                Assert.AreEqual(true, result.IsCompletedSuccessfully);
            }
        }