public void CREATE_FROM_DTO()
        {
            var dto = new ReviewDto()
              {
            Id = _TestId,
            Comments = _TestComments,
            Rating = _TestRating,
            CustomerId = _TestCustomerId
              };

              var review = Review.Create(dto);
        }
        public void LOAD_FROM_DTO()
        {
            //HACK: ReviewTests.LOAD_FROM_DTO: I'm not sure if I should new up or touch DB using CreateNew().  Right now, I'm touching the DB.
              var dto = new ReviewDto();
              dto.Comments = _TestComments;
              dto.Rating = _TestRating;
              var cust = Customer.CreateNew();
              dto.CustomerId = cust.Id;

              var review = Review.CreateNew();
              review.LoadFromDto(dto);

              Assert.AreEqual(dto.Comments, review.Comments);
              Assert.AreEqual(dto.Rating, review.Rating);
              Assert.AreEqual(dto.CustomerId, review.CustomerId);
        }
        public ReviewDto Update(ReviewDto dto)
        {
            ReviewData data = null;
              var results = from r in MockDb.Reviews
                    where r.ReviewId == dto.Id
                    select r;
              if (results.Count() == 1)
              {
            data = results.First();
            MockDb.Reviews.Remove(data);
              }
              else
            data = new ReviewData();
              data.ReviewId = dto.Id;
              data.Rating = dto.Rating;
              data.Comments = dto.Comments;
              data.CustomerId = dto.CustomerId;

              MockDb.Reviews.Add(data);
              return dto;
        }
Exemplo n.º 4
0
 public ReviewDto Update(ReviewDto dto)
 {
     return _DalClient.Update(dto);
 }
Exemplo n.º 5
0
 public ReviewDto Insert(ReviewDto dto)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 6
0
 public void Create(ReviewDto dto)
 {
     throw new NotImplementedException();
 }
        public void DELETE_IMMEDIATELY()
        {
            var custDto = new CustomerDto()
              {
            Id = _DeleteCustomerId,
            Name = _DeleteCustomerName,
            EmailAddress = _DeleteCustomerEmail,
            ReviewIds = new List<Guid>()
            {
              _DeleteReviewId
            }
              };

              var reviewDto = new ReviewDto()
              {
            Id =_DeleteReviewId,
            Rating = _DeleteRating,
            Comments = _DeleteComments,
            CustomerId = _DeleteCustomerId
              };

              //var cust = Customer.Create(custDto, false);
              //var review = Review.Create(revDto);
              //cust.AddChild(review);

              var cust = Customer.Create(custDto, reviewDto);

              cust.Update();

              cust.DeleteImmediately(); //deletes children
              try
              {
            Customer.GetCustomer(cust.Id);
              }
              catch (FaultException fe)
              {
            Review.GetReview(cust.ReviewIds[0]);
            //should throw another FaultException here
              }
        }
Exemplo n.º 8
0
 public ReviewDto Update(ReviewDto dto)
 {
     return ReviewDalImpl.Update(dto);
 }