public ClientOrderReviewReceived FirstClientOrderReviewReceived()
 {
     var firstClientOrderReviewReceived = new ClientOrderReviewReceived
     {
         ClientOrderReviewReceivedId =  1,
         ClientId = 1,
         CookerId = 1,
         MenuId = 1,
         OrderId = 1,
         OverallFeedBackRating = 0,
         ItemAccuracyRating = 0,
         CommunicationRating = 0,
         DeliveryTimeRating = 0,
         Comment = null,
         Photo = null,
         OrderDate = DateTime.Today.Date,
         //View Model OrderItems =  (from c in new FakeOrderItems().MyOrderItems where c.OrderId == 1 select c).ToList()
     };
     return firstClientOrderReviewReceived;
 }
Esempio n. 2
0
        private void UpdateClientFeedBack_And_ReviewScore(ClientOrderReviewReceived clientOrderReviewReceived)
        {
            #region UpdateClientFeedBack
            //Update ClientFeedback
            var clientFeedback = _uow.ClientFeedBackRepository.FindBy(x => x.ClientId == 1).FirstOrDefault();
            Debug.Assert(clientFeedback != null, "clientFeedback != null");

            Assert.AreEqual(1, clientFeedback.TransactionsCount);
            Assert.AreEqual(3, clientFeedback.ReviewScore);
            Assert.AreEqual((decimal)0.2, clientFeedback.PositiveReview);

            clientFeedback.TransactionsCount += 1;
            clientFeedback.ReviewScore = clientFeedback.ReviewScore + clientOrderReviewReceived.ItemAccuracyRating +
                                         clientOrderReviewReceived.CommunicationRating +
                                         clientOrderReviewReceived.DeliveryTimeRating;

            if (clientOrderReviewReceived.OverallFeedBackRating == (int)RatingCodeType.Values.Positive)
            {
                clientFeedback.PositiveReview = clientFeedback.PositiveReview + (int)RatingCodeType.Values.Positive;
            }
            Assert.AreEqual(2, clientFeedback.TransactionsCount);
            Assert.AreEqual(12, clientFeedback.ReviewScore);
            Assert.AreEqual((decimal)1.2, clientFeedback.PositiveReview);

            #endregion

            #region UpdateClientReviewScore
            //Update ClientReviewScore
            var clientReviewScore = _uow.ClientReviewScoreRepository.FindBy(x => x.ClientId == 1).FirstOrDefault();
            Debug.Assert(clientReviewScore != null, "clientReviewScore != null");

            Assert.AreEqual(1, clientReviewScore.PositiveReview);
            Assert.AreEqual(0, clientReviewScore.NegativeReview);
            Assert.AreEqual(0, clientReviewScore.NeutralReview);

            if (clientOrderReviewReceived.OverallFeedBackRating == (int)RatingCodeType.Values.Positive)
            {
                clientReviewScore.PositiveReview = clientReviewScore.PositiveReview + 1;
            }
            if (clientOrderReviewReceived.OverallFeedBackRating == (int)RatingCodeType.Values.Negative)
            {
                clientReviewScore.NegativeReview = clientReviewScore.NegativeReview + 1;
            }
            if (clientOrderReviewReceived.OverallFeedBackRating == (int)RatingCodeType.Values.Neutral)
            {
                clientReviewScore.NeutralReview = clientReviewScore.NeutralReview + 1;
            }

            Assert.AreEqual(2, clientReviewScore.PositiveReview);
            Assert.AreEqual(0, clientReviewScore.NegativeReview);
            Assert.AreEqual(0, clientReviewScore.NeutralReview);

            #endregion
        }
Esempio n. 3
0
 private ClientOrderReviewReceived ClientOrderReviewReceived(OrderSubscriptionItem firstsubscriptionItemForWeek1)
 {
     Assert.AreEqual(0, _uow.ClientOrderReviewReceivedRepository.FindBy(x => x.OrderId == firstsubscriptionItemForWeek1.OrderSubscriptionId).Count());
     var clientOrderReviewReceived = new ClientOrderReviewReceived
     {
         ClientOrderReviewReceivedId = _uow.ClientOrderReviewReceivedRepository.All.ToList().Max(x => x.ClientOrderReviewReceivedId) + 1,
         CookerId = firstsubscriptionItemForWeek1.CookerId,
         ClientId = 2,
         MenuId = firstsubscriptionItemForWeek1.MenuId,
         OrderId = firstsubscriptionItemForWeek1.OrderSubscriptionId,
         OverallFeedBackRating = (int)RatingCodeType.Values.Positive,
         ItemAccuracyRating = 4,
         CommunicationRating = 3,
         DeliveryTimeRating = 2,
         Comment = null,
         Photo = null,
         OrderDate = DateTime.Today.Date,
     };
     _uow.ClientOrderReviewReceivedRepository.Add(clientOrderReviewReceived);
     _uow.Save();
     Assert.AreEqual(1, _uow.ClientOrderReviewReceivedRepository.FindBy(x => x.OrderId == firstsubscriptionItemForWeek1.OrderSubscriptionId).Count());
     return clientOrderReviewReceived;
 }