public void CustomerSubscriptionsConfigurationsCreatedSuccessfully()
        {
            var _customerSubscriptionsConfigurationsRepository = StartUpTests.ServiceProvider.GetService <ICustomerSubscriptionsConfigurationsRepository>();

            Guid configurationId    = Guid.NewGuid();
            Guid userSubscriptionId = Guid.NewGuid();
            CustomerSubscriptionsConfigurations customerSubscription = CustomerSubscriptionsConfigurations.Create(userSubscriptionId, configurationId, false);

            _customerSubscriptionsConfigurationsRepository.Save(customerSubscription);
            StartUpTests.UnitOfWork.Save();
            Assert.IsNotNull(customerSubscription.Id);

            CustomerSubscriptionsConfigurations customerSubscriptionsConfigurationsRead = _customerSubscriptionsConfigurationsRepository.Find(customerSubscription.Id);

            Assert.IsNotNull(customerSubscriptionsConfigurationsRead);
            Assert.AreEqual(configurationId, customerSubscriptionsConfigurationsRead.ConfigurationId);
            Assert.AreEqual(userSubscriptionId, customerSubscriptionsConfigurationsRead.UserSubscriptionId);
            Assert.AreEqual(false, customerSubscriptionsConfigurationsRead.Enabled);
        }
Ejemplo n.º 2
0
        public void Edit_CustomerSubscritionConfiguration_With_Domain_Events()
        {
            Guid userSubsCriptionId = Guid.NewGuid();
            Guid configurationId    = Guid.NewGuid();
            bool enabled            = true;

            CustomerSubscriptionsConfigurations customerSubscriptionsConfigurations = CustomerSubscriptionsConfigurations.Create(userSubsCriptionId, configurationId, enabled);

            customerSubscriptionsConfigurations.Edit(userSubsCriptionId, configurationId, false);

            Assert.AreEqual(customerSubscriptionsConfigurations.UncommittedChanges().Count, 2);
        }
        public Task <Guid> Handle(CreateCustomerSubscriptionsConfigurationsCommand request, CancellationToken cancellationToken)
        {
            CustomerSubscriptionsConfigurations customerSubscriptionsConfigurations = CustomerSubscriptionsConfigurations.Create(request.UserSubscriptionId, request.ConfigurationId, request.Enabled);

            _customerSubscriptionsConfigurationsRepository.Save(customerSubscriptionsConfigurations);
            _unitOfWork.Save();

            return(Task.FromResult(customerSubscriptionsConfigurations.Id));
        }