Example #1
0
        public void RegisterAnAccountTwiceShouldFail()
        {
            var mvr = new VisugDemo.Infrastructure.MiniVanRegistry();
            mvr.RegisterArType<Account>();
            var SUT = new SpecBus(mvr);

            SUT.Given(x => x.AccountRegistered(Ordername: "Tom", AccountNumber: "123-456789-01", AccountId: "account/1"));
            SUT.When(x => x.RegisterAccount(Ordername: "Tom", AccountNumber: "123-456789-01", AccountId: "account/1"));
            SUT.ThenException<InvalidOperationException>();
        }
Example #2
0
        public void PopulateAccountList()
        {
            var mvr = new VisugDemo.Infrastructure.MiniVanRegistry();
            var state = new Dictionary<string,string>();
            var SUT = new AccountListHandler(state);
            mvr.RegisterNonArInstance(SUT);

            var bus = new SpecBus(mvr);

            bus.Given(x=>x.AccountRegistered(Ordername: "Tom", AccountNumber: "1", AccountId: "act/1"));
            bus.Given(x=>x.AccountRegistered(Ordername: "Tom 2", AccountNumber: "2", AccountId: "act/2"));
            bus.Given(x=>x.AccountRegistered(Ordername: "Tom 3", AccountNumber: "3", AccountId: "act/3"));
            Assert.AreEqual(3, state.Count);
        }
Example #3
0
        public void RegisterAnAccount()
        {
            var mvr = new VisugDemo.Infrastructure.MiniVanRegistry();
            var cls = new //RegisterAccount
            {
                Ordername = "Tom",
                AccountNumber = "123-456789-01",
                AccountId = "account/1"
            };

            mvr.RegisterArType<Account>();
            var SUT = new SpecBus(mvr);

            SUT.When(x => x.RegisterAccount(Ordername: "Tom", AccountNumber: "123-456789-01", AccountId: "account/1"));
            SUT.Then(x => x.AccountRegistered(Ordername: "Tom", AccountNumber: "123-456789-01", AccountId: "account/1"));
        }