Exemplo n.º 1
0
 public void TestSetup()
 {
     context            = new XrmFakedContext();
     service            = new TestCrmService(context);
     controller         = new PingController(service);
     controller.Request = new System.Net.Http.HttpRequestMessage();
 }
 public void Setup()
 {
     this.logger = new TestLogger();
     this.configurationService = new TestConfigurationService();
     this.crmService           = new TestCrmService();
     this.deallocationService  = new DeallocationService(this.logger, this.crmService);
 }
 public void Setup()
 {
     this.logger = new TestLogger();
     this.configurationService           = new TestOutboundSyncConfigurationService();
     this.crmService                     = new TestCrmService();
     this.jwtService                     = new TestJwtService();
     this.requestPayloadCreator          = new TestRequestPayloadCreator();
     this.outboundSynchronisationService = new OutboundSynchronisationDataService(this.logger, this.crmService);
 }
        public void ActionThrowsException()
        {
            TestCrmService service = new TestCrmService(context);

            service.Switch     = DataSwitch.ActionThrowsError;
            controller         = new SurveyController(surveyService, service);
            controller.Request = new System.Net.Http.HttpRequestMessage();
            controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            var response = controller.Create(survey);

            Assert.AreEqual(response.StatusCode, HttpStatusCode.GatewayTimeout);
        }
Exemplo n.º 5
0
 public void TestSetup()
 {
     context        = new XrmFakedContext();
     crmService     = new TestCrmService(context);
     bookingService = new BookingService(
         new CacheBuckets.BrandBucket(crmService)
         , new CacheBuckets.CountryBucket(crmService)
         , new CacheBuckets.CurrencyBucket(crmService)
         , new CacheBuckets.GatewayBucket(crmService)
         , new CacheBuckets.SourceMarketBucket(crmService)
         , new CacheBuckets.TourOperatorBucket(crmService)
         , new CacheBuckets.HotelBucket(crmService));
 }
        public void ActionThrowsException()
        {
            BookingInformation bookingInfo = new BookingInformation();

            bookingInfo.Booking = bookingWithNmber;
            TestCrmService service = new TestCrmService(context);

            service.Switch     = DataSwitch.ActionThrowsError;
            controller         = new BookingController(bookingService, service);
            controller.Request = new System.Net.Http.HttpRequestMessage();
            controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            var response = controller.Update(bookingInfo);

            Assert.AreEqual(response.StatusCode, HttpStatusCode.InternalServerError);
        }
Exemplo n.º 7
0
        public void CustomerCreated()
        {
            CustomerInformation customerInfo = new CustomerInformation();

            customerInfo.Customer = customer;
            TestCrmService service = new TestCrmService(context);

            service.Switch     = DataSwitch.Created;
            parameterService   = new PatchParameterService();
            controller         = new CustomerController(customerService, service, parameterService);
            controller.Request = new System.Net.Http.HttpRequestMessage();
            controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            var response = controller.Create(customerInfo);

            Assert.AreEqual(response.StatusCode, HttpStatusCode.Created);
        }
        public void ServiceLayerThrowsException()
        {
            TestCrmService service = new TestCrmService(context);

            service.Switch     = DataSwitch.Created;
            controller         = new SurveyController(surveyService, null);
            controller.Request = new System.Net.Http.HttpRequestMessage();
            controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            survey = new List <Response>();
            survey.Add(new Response()
            {
                Id = 123, CookieUID = "123", Mode = "WEB"
            });
            var response = controller.Create(survey);

            Assert.AreEqual(response.StatusCode, HttpStatusCode.InternalServerError);
        }
Exemplo n.º 9
0
        public void CustomerUpdated()
        {
            JsonPatchDocument <CustomerInformation> customerInfo = new JsonPatchDocument <CustomerInformation>();

            customerInfo.Add("Customer/CustomerIdentity/FirstName", "John");
            customerInfo.Add("Customer/CustomerGeneral/CustomerType", "Person");
            TestCrmService service = new TestCrmService(context);

            service.Switch     = DataSwitch.Updated;
            parameterService   = new PatchParameterService();
            controller         = new CustomerController(customerService, service, parameterService);
            controller.Request = new System.Net.Http.HttpRequestMessage();
            controller.Request.Properties.Add(HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration());
            var response = controller.Update("123", customerInfo);

            Assert.AreEqual(response.StatusCode, HttpStatusCode.NoContent);
        }
 public void TestSetup()
 {
     context         = new XrmFakedContext();
     crmService      = new TestCrmService(context);
     customerService = new CustomerService(new CountryBucket(crmService), new SourceMarketBucket(crmService));
 }
Exemplo n.º 11
0
 public void TestSetup()
 {
     context       = new XrmFakedContext();
     surveyService = new SurveyService();
     crmService    = new TestCrmService(context);
 }