public CustomerDto Update(CustomerDto dto)
 {
     var data = GetCustomer(dto.Id);
       data.Name = dto.Name;
       data.EmailAddress = dto.EmailAddress;
       data.ReviewIds = new List<Guid>(dto.ReviewIds);
       return dto;
 }
        public void CREATE_FROM_DTO()
        {
            CustomerDto dto = new CustomerDto()
              {
            Id = MockDbTestData.CustId1,
            Name=MockDbTestData.CustName1,
            EmailAddress = MockDbTestData.CustEmail1,
            ReviewIds = new List<Guid>()
            {
              MockDbTestData.ReviewId1
            }
              };

              var cust = Customer.Create(dto);
        }
 public CustomerDto Update(CustomerDto dto)
 {
     return _DalClient.Update(dto);
 }
 public CustomerDto Insert(CustomerDto dto)
 {
     return null;
       //_DalClient.Insert(dto);
 }
 public void Create(CustomerDto 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
              }
        }
        public void LOAD_FROM_DTO()
        {
            var dto = new CustomerDto()
              {
            Id = MockDbTestData.CustId1,
            Name = MockDbTestData.CustName1,
            EmailAddress = MockDbTestData.CustEmail1,
            ReviewIds = new List<Guid>()
            {
              MockDbTestData.ReviewId1
            }
              };

              var cust = Customer.CreateNew();
              cust.LoadFromDto(dto);

              Assert.AreEqual(dto.Name, cust.Name);
              Assert.AreEqual(dto.EmailAddress, cust.EmailAddress);
              for (int i = 0; i < cust.ReviewIds.Count; i++)
              {
            Assert.AreEqual(cust.ReviewIds[i], dto.ReviewIds[i]);
              }

              dto = new CustomerDto()
              {
            Id = MockDbTestData.CustId2,
            Name = MockDbTestData.CustName2,
            EmailAddress = MockDbTestData.CustEmail2,
            ReviewIds = new List<Guid>()
            {
              MockDbTestData.ReviewId2A,
              MockDbTestData.ReviewId2B
            }
              };

              cust = Customer.CreateNew();
              cust.LoadFromDto(dto);

              Assert.AreEqual(dto.Name, cust.Name);
              Assert.AreEqual(dto.EmailAddress, cust.EmailAddress);
              for (int i = 0; i < cust.ReviewIds.Count; i++)
              {
            Assert.AreEqual(cust.ReviewIds[i], dto.ReviewIds[i]);
              }
        }
 public CustomerDto Update(CustomerDto dto)
 {
     return CustomerDalImpl.Update(dto);
 }