示例#1
0
        public void OnGet()
        {
            // Arrange
            var context = new Mock <IConfigurationDbContext>();
            var create  = new CreateModel(context.Object);

            // Act
            var get = create.OnGet();

            // Assert
            Assert.NotNull(create.ApiResource);
            Assert.IsType <PageResult>(get);
        }
示例#2
0
        public void OnGet()
        {
            // Arrange
            var create = new CreateModel(_roleManager.Object, _userManager.Object);

            // Act
            var get = create.OnGet();

            // Assert
            Assert.NotNull(create.Role);
            Assert.Empty(create.Users);
            Assert.IsType <PageResult>(get);
        }
示例#3
0
        public void OnGet()
        {
            #region Arrange
            var optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>()
                                 .UseInMemoryDatabase("InMemoryDb");
            var mockDb = new ApplicationDbContext(optionsBuilder.Options);

            var pageModel = new CreateModel(mockDb);

            #endregion

            #region Act
            var page = pageModel.OnGet();
            #endregion

            #region Assert
            Assert.Equal(
                typeof(PageResult),
                page.GetType());
            #endregion
        }