예제 #1
0
        public void A_ChangedTitle_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 TitleRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //3.- Change the aggregate
            aggr.NameKeyId = StringExtension.RandomString(10);
            aggr.SapCode = StringExtension.RandomString(2);
            aggr.Deleted = new Random().Next();

            //4.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(ChangedTitle).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });


            //5.- Load the saved country
            var title = repository.Get(aggr.Id);
            //6.- Check equality
            Assert.True(ObjectExtension.AreEqual(aggr, title));
        }
예제 #2
0
        public void A_UnregisteredTitle_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 TitleRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //3.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(UnregisteredTitle).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });

            var tax = repository.Get(aggr.Id);
            Assert.Null(tax);
        }