public void AddCustomerToGoldCompany()
 {
     this.companyRepository.Stub(cr => cr.GetById(1)).Return(base.GoldCompany);
     this.provider.Stub(p => p.AddCustomer(base.ValidCustomer));
     this.service = new CustomerService(companyRepository, serviceMock, provider);
     Assert.IsTrue(service.AddCustomer(ValidCustomer.FirstName, ValidCustomer.LastName, ValidCustomer.EmailAddress, ValidCustomer.DateOfBirth, 1));
     Assert.IsFalse(service.Customer.HasCreditLimit);
 }
Пример #2
0
 public void InitScenario()
 {
     _companyRepository   = new Mock <ICompanyRepository>();
     _customerDataAccess  = new Mock <ICustomerDataAccess>();
     _clientHelpers       = new Mock <IClientHelpers>();
     _creditHelpers       = new Mock <ICreditHelpers>();
     _mockCustomerService = new App.CustomerService(_companyRepository.Object, _customerDataAccess.Object, _clientHelpers.Object, _creditHelpers.Object);
     _dateOfBirth         = new DateTime(1984, 7, 25);
     _customerInfo        = new Customer();
 }
        public override void TestSetup()
        {
            base.TestSetup();
            mockRepository = new MockRepository();
            serviceMock = mockRepository.PartialMock<PartialMockService>();

            try
            {
                host = new ServiceHost(serviceMock);
                host.AddServiceEndpoint(typeof(ICustomerCreditService), new BasicHttpBinding(), "http://localhost:8091/Service.svc");
                host.Open();
            }
            finally
            {
                if(host != null && host.State != CommunicationState.Faulted)
                {
                    ((IDisposable)host).Dispose();
                }
            }

            this.companyRepository = MockRepository.GenerateStrictMock<ICompanyRepository>();
            this.provider = MockRepository.GenerateMock<ICustomerDataAccessProvider>();
            this.service = new CustomerService(companyRepository, serviceMock, provider);
        }