public void A_ChangedTax_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 TaxRepository(_configuration.TestServer); repository.Insert(aggr); //3.- Change the aggregate aggr.NameKeyId = StringExtension.RandomString(10); aggr.CountryId = Guid.NewGuid(); aggr.SapCode = StringExtension.RandomString(2); aggr.CurrencyId = Guid.NewGuid(); aggr.BaseAmount = decimal.Round(Convert.ToDecimal(new Random().NextDouble()), 2 , MidpointRounding.AwayFromZero); aggr.Amount = decimal.Round(Convert.ToDecimal(new Random().NextDouble()), 2, MidpointRounding.AwayFromZero); //4.- Emit message var message = GenerateMessage(aggr); message.MessageType = typeof(ChangedTax).Name; serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message }); //5.- Load the saved country var tax = repository.Get(aggr.Id); //6.- Check equality Assert.True(ObjectExtension.AreEqual(aggr, tax)); }
public ActionResult Create(Tax tax) { try { repository.Insert(tax); return(RedirectToAction("Index")); } catch { return(View()); } }
public void A_UnregisteredTax_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 TaxRepository(_configuration.TestServer); repository.Insert(aggr); //3.- Emit message var message = GenerateMessage(aggr); message.MessageType = typeof(UnregisteredTax).Name; serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message }); var tax = repository.Get(aggr.Id); Assert.Null(tax); }