public void A_ChangedGateway_modifies_Existing_Gateway_in_the_database() { var bootStrapper = new BootStrapper(); bootStrapper.StartServices(); var serviceEvents = bootStrapper.GetService<IServiceEvents>(); //1.- Create message var aggr = GenerateRandomAggregate(); //2.- Create the tuple in the database var repository = new PaymentGatewayRepository(_configuration.TestServer); repository.Insert(aggr); //3.- Change the aggregate aggr.GatewayDescription = StringExtension.RandomString(20); aggr.GatewayByCountry.ToList().ForEach(e => e.CountryId = Guid.NewGuid()); //4.- Emit message var message = GenerateMessage(aggr); message.MessageType = typeof(ChangedPaymentGateway).Name; serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message }); //5.- Load the saved country var gateway = repository.Get(aggr.Id); //6.- Check equality Assert.True(ObjectExtension.AreEqual(aggr, gateway)); }
public void A_UnregisteredCountry_modifies_Existing_country_in_the_database() { var bootStrapper = new BootStrapper(); bootStrapper.StartServices(); var serviceEvents = bootStrapper.GetService<IServiceEvents>(); //1.- Create message var aggr = GenerateRandomAggregate(); //2.- Create the tuple in the database var repository = new PaymentGatewayRepository(_configuration.TestServer); repository.Insert(aggr); //2.- Emit message var message = GenerateMessage(aggr); message.MessageType = typeof(UnregisteredPaymentGateway).Name; serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message }); var country = repository.Get(aggr.Id); Assert.Null(country); }