private void ThenUpdateTheBusinessWithChanges(ApiResponse response, ApiBusinessSaveCommand command, SetupData setup)
            {
                var responseBusiness = AssertSuccessResponse <BusinessData>(response);

                Assert.That(responseBusiness.id, Is.EqualTo(setup.Business.Id));
                Assert.That(responseBusiness.name, Is.EqualTo(command.name));
                Assert.That(responseBusiness.domain, Is.EqualTo(command.domain.ToLowerInvariant()));
                Assert.That(responseBusiness.sport, Is.EqualTo(command.sport));
                Assert.That(responseBusiness.payment.currency, Is.EqualTo(command.payment.currency));
                Assert.That(responseBusiness.payment.isOnlinePaymentEnabled, Is.EqualTo(command.payment.isOnlinePaymentEnabled));
                Assert.That(responseBusiness.payment.forceOnlinePayment, Is.EqualTo(command.payment.forceOnlinePayment));
                Assert.That(responseBusiness.payment.paymentProvider, Is.EqualTo(command.payment.paymentProvider));
                Assert.That(responseBusiness.payment.merchantAccountIdentifier, Is.EqualTo(command.payment.merchantAccountIdentifier));

                var getResponse = AuthenticatedGet <BusinessData>("Business", setup);
                var getBusiness = (BusinessData)getResponse.Payload;

                Assert.That(getBusiness.id, Is.EqualTo(setup.Business.Id));
                Assert.That(getBusiness.name, Is.EqualTo(command.name));
                Assert.That(getBusiness.domain, Is.EqualTo(command.domain.ToLowerInvariant()));
                Assert.That(getBusiness.sport, Is.EqualTo(command.sport));
                Assert.That(getBusiness.payment.currency, Is.EqualTo(command.payment.currency));
                Assert.That(getBusiness.payment.isOnlinePaymentEnabled, Is.EqualTo(command.payment.isOnlinePaymentEnabled));
                Assert.That(getBusiness.payment.forceOnlinePayment, Is.EqualTo(command.payment.forceOnlinePayment));
                Assert.That(getBusiness.payment.paymentProvider, Is.EqualTo(command.payment.paymentProvider));
                Assert.That(getBusiness.payment.merchantAccountIdentifier, Is.EqualTo(command.payment.merchantAccountIdentifier));
            }
 private void ThenReturnsDuplicateSubdomainError(ApiResponse response, ApiBusinessSaveCommand command, SetupData setup)
 {
     AssertSingleError(response,
                       ErrorCodes.SubdomainDuplicate,
                       string.Format("The subdomain '{0}' already exists.", command.domain),
                       command.domain);
 }
        private ApiResponse WhenTryUpdateBusinessAnonymously(ApiBusinessSaveCommand command, SetupData setup)
        {
            var json = JsonSerialiser.Serialise(command);

            return(WhenTryUpdateBusinessAnonymously(json, setup));
        }
            private void ThenUpdateTheBusinessWithoutPaymentProvider(ApiResponse response, ApiBusinessSaveCommand command, SetupData setup)
            {
                var responseBusiness = AssertSuccessResponse <BusinessData>(response);

                Assert.That(responseBusiness.id, Is.EqualTo(setup.Business.Id));
                Assert.That(responseBusiness.name, Is.EqualTo(command.name));
                Assert.That(responseBusiness.domain, Is.EqualTo(setup.Business.Domain));
                Assert.That(responseBusiness.sport, Is.EqualTo(setup.Business.Sport));
                Assert.That(responseBusiness.payment.currency, Is.EqualTo(command.payment.currency));
                Assert.That(responseBusiness.payment.paymentProvider, Is.Null);

                var getResponse = AuthenticatedGet <BusinessData>("Business", setup);
                var getBusiness = (BusinessData)getResponse.Payload;

                Assert.That(getBusiness.id, Is.EqualTo(setup.Business.Id));
                Assert.That(getBusiness.name, Is.EqualTo(command.name));
                Assert.That(getBusiness.domain, Is.EqualTo(setup.Business.Domain));
                Assert.That(getBusiness.payment.currency, Is.EqualTo(command.payment.currency));
                Assert.That(getBusiness.payment.paymentProvider, Is.Null);
            }
 private void ThenReturnsInvalidSubdomainFormatError(ApiResponse response, ApiBusinessSaveCommand command, SetupData setup)
 {
     AssertSingleError(response,
                       ErrorCodes.SubdomainFormatInvalid,
                       string.Format("The subdomain '{0}' is not in a valid format.", command.domain),
                       command.domain);
 }