public void A_ChangedPayable_modifies_Existing_Payable_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 PayableRepository(_configuration.TestServer); repository.Insert(aggr); //3.- Change the aggregate aggr.CurrencyId = Guid.NewGuid(); aggr.PaymentTransaction.ToList().ForEach(t => { t.PartnerId = Guid.NewGuid(); t.Payment.PaymentType = new Random().Next(); t.Payment.PaymentMpos.OperationNumber = StringExtension.RandomString(5); t.PaymentTaxTransaction.ToList().ForEach(tt => { tt.TaxId = Guid.NewGuid(); }); }); //4.- Emit message var message = GenerateMessage(aggr); message.MessageType = typeof(ChangedPayable).Name; serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message }); //5.- Load the saved country var country = repository.Get(aggr.Id); //6.- Check equality Assert.True(ObjectExtension.AreEqual(aggr, country)); }
public void A_UnregisteredPayable_modifies_Existing_Payable_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 PayableRepository(_configuration.TestServer); repository.Insert(aggr); //2.- Emit message var message = GenerateMessage(aggr); message.MessageType = typeof(UnregisteredPayable).Name; serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message }); var country = repository.Get(aggr.Id); Assert.Null(country); }