public QuestionController(QuestionRepository questionRepository, QuestionCategoryRepository qcRepo, AnswerRepository aRepo, FeedbackRepository fRepo, IHostingEnvironment hostingEnvironment) : base(questionRepository)
 {
     _hostingEnvironment   = hostingEnvironment;
     _questionCategoryRepo = qcRepo;
     _answerRepo           = aRepo;
     _feedBackRepo         = fRepo;
 }
Esempio n. 2
0
        public async void GetFeedbackById_IfIdExist_ExpectedFeedbackId(int feedbackId, int expected)
        {
            //Arrange
            var     profile       = new MappedProfile();
            var     configuration = new MapperConfiguration(x => x.AddProfile(profile));
            IMapper mapper        = new Mapper(configuration);

            var testFeedback = GetFeedbacks();
            //mock dataContext
            var contextMock = new Mock <DataContext>();

            contextMock.Setup(x => x.Feedbacks).ReturnsDbSet(testFeedback);

            //mockRepo
            var logger       = Mock.Of <ILogger <FeedbackRepository> >();
            var feedbackRepo = new FeedbackRepository(contextMock.Object, logger);

            //Mock actionDescriptor
            var action = new List <ActionDescriptor>();
            var mockDescriptorProvider = new Mock <IActionDescriptorCollectionProvider>();

            mockDescriptorProvider.Setup(x => x.ActionDescriptors).Returns(new ActionDescriptorCollection(action, 0));

            //create new controller
            var controller = new FeedbackController(feedbackRepo, mapper, mockDescriptorProvider.Object);

            //Act
            var result = await controller.GetFeedbackByID(feedbackId, false);

            var         contentResult = result as OkObjectResult;
            FeedbackDTO dto           = (FeedbackDTO)contentResult.Value;

            //Assert
            Assert.Equal(feedbackId, expected);
        }
Esempio n. 3
0
 public FeedbackManager(UserRepository userRepository, FeedbackRepository feedbackRepository, BookVersionRepository bookVersionRepository, AuthorizationManager authorizationManager)
 {
     m_userRepository        = userRepository;
     m_feedbackRepository    = feedbackRepository;
     m_bookVersionRepository = bookVersionRepository;
     m_authorizationManager  = authorizationManager;
 }
        static AppActs.API.Service.Interface.IDeviceService setup()
        {
            MongoClient client   = new MongoClient(ConfigurationManager.ConnectionStrings["connectionString"].ConnectionString);
            string      database = ConfigurationManager.AppSettings["database"];

            AppActs.Repository.Interface.IApplicationRepository applicationRepository = new AppActs.Repository.ApplicationRepository(client, database);
            IDeviceRepository      deviceRepository   = new DeviceRepository(new DeviceMapper(client, database));
            IFeedbackRepository    feedbackRepository = new FeedbackRepository(new FeedbackMapper(client, database));
            IEventRepository       eventRep           = new EventRepository(new EventMapper(client, database));
            ICrashRepository       crashRep           = new CrashRepository(new CrashMapper(client, database));
            IAppUserRepository     appUserRep         = new AppUserRepository(new AppUserMapper(client, database));
            IErrorRepository       errorRep           = new ErrorRepository(new ErrorMapper(client, database));
            ISystemErrorRepository systemErrorRep     = new SystemErrorRepository(new SystemErrorMapper(client, database));

            return(new DeviceService
                   (
                       deviceRepository,
                       errorRep,
                       eventRep,
                       crashRep,
                       feedbackRepository,
                       systemErrorRep,
                       appUserRep,
                       applicationRepository,
                       new Model.Settings()
            {
                DataLoggingRecordRaw = true,
                DataLoggingRecordSystemErrors = true
            }
                   ));
        }
Esempio n. 5
0
        public async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var _repository = new FeedbackRepository(); // TODO : respecter cycle vie Dialog + DI

            var userFeedback = await result;

            switch (userFeedback.Text.ToLower())
            {
            case "yes-positive-feedback":
                await _repository.SaveAsync(new FeedbackEntity()
                {
                    Question = userQuestion,
                    Feedback = "satisfied"
                });

                break;

            case "no-negative-feedback":
                await _repository.SaveAsync(new FeedbackEntity()
                {
                    Question = userQuestion,
                    Feedback = "not satisfied"
                });

                break;

            default:
                context.Done(userFeedback);
                return;
            }

            await context.PostAsync("Merci de votre retour!");
        }
Esempio n. 6
0
        public async void GetAllFeedbacks_IfExist_ExpectedTrue()
        {
            //Arrange
            var profile       = new MappedProfile();
            var configuration = new MapperConfiguration(x => x.AddProfile(profile));
            var mapper        = new Mapper(configuration);

            //Mock DataContext
            var tesFeedbacks = GetFeedbacks();
            var mockContext  = new Mock <DataContext>();

            mockContext.Setup(c => c.Feedbacks).ReturnsDbSet(tesFeedbacks);
            //mock Repo
            var logger           = Mock.Of <ILogger <FeedbackRepository> >();
            var feedbackRepoMock = new FeedbackRepository(mockContext.Object, logger);

            //Mock IActionDescriptorCollectionProvider
            var action = new List <ActionDescriptor>();
            var mockDescriptorProvider = new Mock <IActionDescriptorCollectionProvider>();

            mockDescriptorProvider.Setup(x => x.ActionDescriptors).Returns(new ActionDescriptorCollection(action, 0));

            //Creating controller
            var controller = new FeedbackController(feedbackRepoMock, mapper, mockDescriptorProvider.Object);

            //Act
            var result = await controller.GetAllFeedbacks(false);

            var contentResult = result.Result as OkObjectResult;

            FeedbackDTO [] dto = (FeedbackDTO[])contentResult.Value;

            //Assert
            Assert.True(dto.Length > 0);
        }
Esempio n. 7
0
        // Gets All Feedback
        public List <FeedbackEntity> GetAllFeedback(int SortOrder, int PageNumber, int PageSize, out int TotalRecords, string HostName, string FeedbackType)
        {
            FeedbackRepository    rep     = new FeedbackRepository();
            List <FeedbackEntity> results = new List <FeedbackEntity>();

            results = rep.GetAllFeedback(SortOrder, PageNumber, PageSize, out TotalRecords, HostName, FeedbackType);
            return(results);
        }
 public void TestInitialize()
 {
     InitializeTestDatabase();
     Repository = new FeedbackRepository(DocumentStore);
     Controller = new FeedbackController(Repository);
     Fixture    = new Fixture();
     Count      = 20;
     AddFeedbacks();
 }
Esempio n. 9
0
 public RecipeController(RecipeRepository recipeRepository, RecipeIngredientRepository recipeIngredientRepository, IngredientRepository ingredientRepository, SavedRecipesRepository savedRecipes, UserRepository users, FeedbackRepository feedback)
 {
     _recipeRepository           = recipeRepository;
     _recipeIngredientRepository = recipeIngredientRepository;
     _ingredientRepository       = ingredientRepository;
     _savedRecipes = savedRecipes;
     _users        = users;
     _feedback     = feedback;
 }
 public void Setup()
 {
     ICollection<Employee> dbEmployees = Substitute.For<ICollection<Employee>>();
     employees = Substitute.For<IMongoCollection<Employee>>();
     binaryFiles = Substitute.For<IGridFSBucket>();
     dbEmployees.Load().Returns(employees);
     dbEmployees.CreateGridFSBucket().Returns(binaryFiles);
     sut = new FeedbackRepository(dbEmployees);
 }
Esempio n. 11
0
        public void TestInitialize()
        {
            _mockFeedbacks = new TestDbSet <Feedback>();
            var mockContext = new Mock <IApplicationDbContext>();

            mockContext.SetupGet(c => c.Feedbacks).Returns(_mockFeedbacks);

            _repoitory = new FeedbackRepository(mockContext.Object);
        }
Esempio n. 12
0
        public void Setup()
        {
            ICollection <Employee> dbEmployees = Substitute.For <ICollection <Employee> >();

            employees   = Substitute.For <IMongoCollection <Employee> >();
            binaryFiles = Substitute.For <IGridFSBucket>();
            dbEmployees.Load().Returns(employees);
            dbEmployees.CreateGridFSBucket().Returns(binaryFiles);
            sut = new FeedbackRepository(dbEmployees);
        }
Esempio n. 13
0
        public List <feedback> GetListFeedback(string search)
        {
            if (Equals(search, null))
            {
                search = "";
            }

            return(FeedbackRepository.FindBy(p =>
                                             p.customer_email.Contains(search) || p.customer_name.Contains(search)).ToList());
        }
Esempio n. 14
0
        /// <summary>
        /// Initializes a new instance of the FeedbackService class.
        /// </summary>
        /// <param name="unitOfWork">UnitOfWork information</param>
        public FeedbackService(UnitOfWork unitOfWork)
        {
            if (unitOfWork == null)
            {
                throw new ArgumentNullException(UnitOfWorkConst);
            }

            this.unitOfWork = unitOfWork;
            this.feedbackRepository = new FeedbackRepository(this.unitOfWork);
        }
Esempio n. 15
0
 public UnitOfWork(photostudioContext context)
 {
     _context     = context;
     Photos       = new PhotoRepository(_context);
     Schedules    = new ScheduleRepository(_context);
     Appointments = new AppointmentRepository(_context);
     Contacts     = new ContactRepository(_context);
     Feedbacks    = new FeedbackRepository(_context);
     ShootTypes   = new ShootType(_context);
 }
 public CategoryService(CategoryRepository categoryRepository, StudentCourseRepository studentCourseRepository,
                        CourseRepository courseRepository, ViewRepository viewRepository,
                        FeedbackRepository feedbackRepository, UserRepository userRepository)
 {
     this.categoryRepository      = categoryRepository;
     this.studentCourseRepository = studentCourseRepository;
     this.courseRepository        = courseRepository;
     this.viewRepository          = viewRepository;
     this.feedbackRepository      = feedbackRepository;
     this.userRepository          = userRepository;
 }
Esempio n. 17
0
        public void FeedbackTest()
        {
            var repository = new FeedbackRepository(new MongoContext("mongodb://localhost/WeatherAggregator"));
            var listBefore = repository.GetAll();

            repository.Add(new Feedback {
                DateCreated = DateTime.Now, Email = "lol.com", Name = "lol", Text = "Text"
            });
            var listAfter = repository.GetAll();

            Assert.Greater(listAfter.Count, listBefore.Count, "The item hasn't been added.");
        }
        public void Given_FeedbackRepository_When_AddAsyncingAFeedback_Then_TheFeedbackShouldBeProperlySaved()
        {
            RunOnDatabase(async ctx => {
                //Arrange
                var repository = new FeedbackRepository(ctx);
                var feedback   = Feedback.Create("OK", null, null, 5);

                //Act
                await repository.AddAsync(feedback);

                //Assert
                Assert.AreEqual(repository.GetAllAsync().Result.Count, 1);
            });
        }
        public IHttpActionResult GetFeedbackByCustomerID(int cid)
        {
            FeedbackRepository feedbackDB = new FeedbackRepository();

            var feedbackFromDB = feedbackDB.GetFeedbackByCustomerID(cid);

            if (feedbackFromDB.Count != 0)
            {
                return(Ok(feedbackFromDB));
            }
            else
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
        }
Esempio n. 20
0
 public UnitOfWork(CuriousDriveContext context)
 {
     _context        = context;
     Roles           = new RoleRepository(_context);
     Messages        = new MessageRepository(_context);
     Users           = new UserRepository(_context);
     Questions       = new QuestionRepository(_context);
     Classes         = new ClassRepository(_context);
     QuestionAnswers = new QuestionAnswerRepository(_context);
     QuestionClasses = new QuestionClassRepository(_context);
     Comments        = new CommentRepository(_context);
     Tags            = new TagRepository(_context);
     TagDetails      = new TagDetailRepository(_context);
     Feedback        = new FeedbackRepository(_context);
 }
        public void Given_FeedbackRepository_When_ReturningAllFeedbacks_Then_AllFeedbacksShouldBeProperlyReturned()
        {
            RunOnDatabase(async ctx => {
                //Arrange
                var repository = new FeedbackRepository(ctx);
                var feedback   = Feedback.Create("OK", null, null, 5);
                await repository.AddAsync(feedback);

                //Act
                var count = repository.GetAllAsync().Result.Count;

                //Assert
                Assert.AreEqual(count, 1);
            });
        }
        public void Given_FeedbackRepository_When_ReturningAFeedback_Then_TheFeedbackShouldBeProperlyReturned()
        {
            RunOnDatabase(async ctx => {
                //Arrange
                var repository = new FeedbackRepository(ctx);
                var feedback   = Feedback.Create("OK", null, null, 5);
                await repository.AddAsync(feedback);

                //Act
                var extractedFeedback = await repository.GetByIdAsync(feedback.FeedbackId);

                //Assert
                Assert.AreEqual(feedback, extractedFeedback);
            });
        }
        public void Save()
        {
            IFeedbackRepository iFeedbackRepository = new FeedbackRepository(this.connectionString);

            FeedbackItem feedBackItem = new FeedbackItem
                (
                    "feedback",
                     AppActs.DomainModel.Enum.RatingType.Five,
                     "screenName",
                     Guid.NewGuid(),
                     DateTime.Now,
                     "1.1"
                );

            iFeedbackRepository.Save(this.Application.Id, this.Device.Id, feedBackItem);
        }
Esempio n. 24
0
        public async void GetAllFeedbacks_IfAnyExist_ExpectedTrue()
        {
            //Arrange
            //mocking dataContext
            var mockContext = new Mock <DataContext>();

            mockContext.Setup(x => x.Feedbacks).ReturnsDbSet(GetFeedback());
            //mocking ILogger
            var logger       = Mock.Of <ILogger <FeedbackRepository> >();
            var feedbackRepo = new FeedbackRepository(mockContext.Object, logger);
            //Act
            var result = await feedbackRepo.GetAllFeedbacks(false, false);

            //Assert
            Assert.True(result.Length > 0);
        }
        public void Save()
        {
            IFeedbackRepository iFeedbackRepository = new FeedbackRepository(this.connectionString);

            FeedbackItem feedBackItem = new FeedbackItem
                                        (
                "feedback",
                AppActs.DomainModel.Enum.RatingType.Five,
                "screenName",
                Guid.NewGuid(),
                DateTime.Now,
                "1.1"
                                        );

            iFeedbackRepository.Save(this.Application.Id, this.Device.Id, feedBackItem);
        }
Esempio n. 26
0
        public async void GetFeedbackByID_IFIdFound_ExpectedID(int feedbackId, string expectedComment)
        {
            //Arrange
            var mockContext = new Mock <DataContext>();

            mockContext.Setup(x => x.Feedbacks).ReturnsDbSet(GetFeedback());

            var logger       = Mock.Of <ILogger <FeedbackRepository> >();
            var feedbackRepo = new FeedbackRepository(mockContext.Object, logger);

            //Act
            var result = await feedbackRepo.GetFeedbackByID(feedbackId);

            //Assert
            Assert.Equal(expectedComment, result.Comment);
        }
        public void Given_FeedbackRepository_When_ReturningAFeedback_Then_TheFeedbackShouldBeProperlyReturned()
        {
            RunOnDatabase(async ctx => {
                //Arrange
                var repository = new FeedbackRepository(ctx);
                var patient    = Patient.Create("1234", "Roland", "Iordache", "*****@*****.**", "asfdsdssd", "Iasi", "Romania", new DateTime(1996, 02, 10), "0746524459", null);
                var doctor     = Doctor.Create("1234", "Mircea", "Cartarescu", "*****@*****.**", "parola", "0746524459", "blasdadsadsada", "Cardiologie", "Sf. Spiridon", "Iasi", "Romania", "Str. Vasile Lupu", true);
                var feedback   = Feedback.Create("OK", patient.PatientId, doctor.DoctorId, 5, new DateTime());
                await repository.AddAsync(feedback);

                //Act
                var extractedFeedback = await repository.GetByIdAsync(feedback.FeedbackId);

                //Assert
                Assert.AreEqual(feedback, extractedFeedback);
            });
        }
Esempio n. 28
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text != null)
            {
                FeedbackRepository fd = new FeedbackRepository();
                FeedbackTable      f  = new FeedbackTable();
                long id = Convert.ToInt64(Session["UserID"].ToString());
                f.UserID           = id;
                f.Feedback         = TextBox1.Text;
                f.DateOfSubmission = DateTime.Now;

                Response.Redirect("~/Members/ConfirmedFeedBack.aspx");
            }
            else
            {
                Label2.Text = "Enter your FeedBack";
            }
        }
        public void Given_FeedbackRepository_When_EditingAFeedback_Then_TheFeedbackShouldBeProperlyEdited()
        {
            RunOnDatabase(async ctx => {
                //Arrange
                var repository = new FeedbackRepository(ctx);
                var feedback   = Feedback.Create("OK", null, null, 5);
                await repository.AddAsync(feedback);

                var description = feedback.Description;
                feedback.Update("IT's OK", null, null, 4);

                //Act
                await repository.UpdateAsync(feedback);

                //Assert
                Assert.AreNotEqual(feedback.Description, description);
            });
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            FeedbackRepository br = new FeedbackRepository();
            List <MRSLibrary.Database.FeedbackTable> lst = new List <MRSLibrary.Database.FeedbackTable>();

            lst = br.GetAllFeedbacks();
            if (lst == null)
            {
                Label4.Visible    = true;
                GridView1.Visible = false;
            }
            else
            {
                Label4.Visible       = false;
                GridView1.DataSource = lst;
                GridView1.DataBind();
            }
        }
        protected void btnUser_Click(object sender, EventArgs e)
        {
            FeedbackRepository br = new FeedbackRepository();
            List <MRSLibrary.Database.FeedbackTable> lst = new List <MRSLibrary.Database.FeedbackTable>();

            lst = br.GetFeedbacksForUser(Convert.ToInt32(txtUser.Text));
            if (lst == null)
            {
                Label4.Visible    = true;
                GridView1.Visible = false;
            }
            else
            {
                Label4.Visible       = false;
                GridView1.DataSource = lst;
                GridView1.DataBind();
            }
        }
Esempio n. 32
0
        public static void Create(string playerName, int rating, string details)
        {
            var player = PlayerService.GetByName(playerName);

            if (player == null)
            {
                return;
            }

            var feedback = new Feedback
            {
                PlayerId     = player.Id,
                FeedbackDate = DateTime.Now,
                Rating       = rating,
                Details      = details
            };

            FeedbackRepository.Create(feedback);
        }
        public bool SaveFeedback(string IP)
        {
            bool bRet = false;

            if (Message == null || SenderEmail == null || SenderName == null)
            {
                Error = "You must enter a name, email address and a message";
            }
            else
            {
                FeedbackRepository f = new FeedbackRepository(UserID, "FeedbackModel", "SaveFeedback");
                f.Feedback(SenderName, SenderEmail, Message, IP);
                if (f.O.ToString() != "-1")
                {
                    bRet = true;
                }
            }
            return(bRet);
        }
Esempio n. 34
0
        public async Task<ActionResult> Post(Feedback feedback)
        {
            try
            {
                var feedbackRepo = new FeedbackRepository();

                feedbackRepo.Create(new Feedback
                {
                    Message = feedback.Message,
                    Email = feedback.Email,
                    DatePosted = DateTime.UtcNow
                });

                return Json(new { success = true, responseText = "Added." }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                return Json(new { success = false, responseText = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
        public void SaveThrowsDataAccessLayerException()
        {
            IFeedbackRepository iFeedbackRepository = new FeedbackRepository(this.connectionString);

            iFeedbackRepository.Save(0, 0, new FeedbackItem("feedback", AppActs.DomainModel.Enum.RatingType.Five, "Main", Guid.NewGuid(), DateTime.Now, "1.1.1.1"));
        }
Esempio n. 36
0
 public AdminController(UserRepository userRepository, FeedbackRepository feedbackRepository)
 {
     _userRepository = userRepository;
     _feedbackRepository = feedbackRepository;
 }