Пример #1
0
        public void Setup()
        {
            mapperMock = new Mock <IMapper>();

            List <Book> books = new List <Book>
            {
                BookTestData.BookDummy()
            };

            dbContextMock = new Mock <IDataContext>();
            dbContextMock.Setup(p => p.Books).Returns(DbContextMock.GetQueryableMockDbSet <Book>(books));
            dbContextMock.Setup(p => p.SaveChanges()).Returns(1);
        }
        public void Setup()
        {
            List <User> users = new List <User>
            {
                GetDummyUser()
            };

            dbContextMock = new Mock <IDataContext>();
            dbContextMock.Setup(p => p.Users).Returns(DbContextMock.GetQueryableMockDbSet <User>(users));
            dbContextMock.Setup(p => p.SaveChanges()).Returns(1);

            var mockConfSection = new Mock <IConfigurationSection>();

            mockConfSection.Setup(a => a.Value).Returns("my test secret key");

            mockConfiguration = new Mock <IConfiguration>();
            mockConfiguration.Setup(a => a.GetSection("AppSettings:Token")).Returns(mockConfSection.Object);
        }