Exemple #1
0
        public QuizDataAccessMediatorTests()
        {
            var quizProfile     = new QuizProfile();
            var questionProfile = new QuestionProfile();
            var answerProfile   = new AnswerProfile();
            var configuration   = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(quizProfile);
                cfg.AddProfile(questionProfile);
                cfg.AddProfile(answerProfile);
                cfg.ForAllMaps((tm, me) => me.ForAllMembers(option => option.Condition((source, destination, sourceMember) => sourceMember != null)));
            });

            _mapper = new Mapper(configuration);

            _dalMock = new Mock <IDbOps <EQuiz> >();

            //_httpCtxAccessorMock = new Mock<IHttpContextAccessor>();

            _sut = new QuizDataAccessMediator(_mapper, _dalMock.Object /*, _httpCtxAccessorMock.Object*/);

            var json = File.ReadAllText(_dataFilePath);
            var data = JsonConvert.DeserializeObject <IEnumerable <EQuiz> >(json);

            _dataMock = data.AsQueryable().BuildMock();
        }
Exemple #2
0
        public AnswerDataAccessMediatorTests()
        {
            var quizProfile     = new QuizProfile();
            var questionProfile = new QuestionProfile();
            var answerProfile   = new AnswerProfile();
            var configuration   = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(quizProfile);
                cfg.AddProfile(questionProfile);
                cfg.AddProfile(answerProfile);
            });

            _mapper = new Mapper(configuration);

            _dalMock = new Mock <IDbOps <EAnswer> >();

            _sut = new AnswerDataAccessMediator(_mapper, _dalMock.Object);

            var json = File.ReadAllText(_dataFilePath);
            var data = JsonConvert.DeserializeObject <IEnumerable <EAnswer> >(json);

            _dataMock = data.AsQueryable().BuildMock();
        }