예제 #1
0
        public void DefaultClientGetsCredit()
        {
            var customer = new Customer
            {
                Company = new Company
                {
                    Classification = Classification.Bronze,
                    Id             = 2,
                    Name           = "Test"
                },
                DateOfBirth    = new DateTime(1991, 10, 17),
                EmailAddress   = "*****@*****.**",
                Firstname      = "Joe",
                Surname        = "Blogs",
                HasCreditLimit = false,
                Id             = 0,
                CreditLimit    = 0
            };

            CustomerCreditServiceClientMock
            .Setup(x => x.GetCreditLimit(customer.Firstname, customer.Surname, customer.DateOfBirth)).Returns(500);

            var sut = new DefaultClientStrategy(CustomerCreditServiceClientMock.Object);

            var result = sut.DoCreditCheck(customer);

            result.CreditLimit.ShouldBe(500);
        }
        public override void Initialize(RunFrame frame)
        {
            /// Create a client strategy which is associated with this host strategy.
            /// Client strategy is rather a component relatively indepdent from
            /// host strategy is because not like host strategy, the client
            /// strategy can be different on test method basis. For example the
            /// security credential could be different. So a HttpClient is created
            /// on basis of eacy test method (in the domain of xunit, is every
            /// TestCommand).
            var clientStrategy = new DefaultClientStrategy
            {
                MessageLog = MessageLog,
                UseProxy   = UseProxy
            };

            frame.SetState(KeyClientStrategy, clientStrategy);
        }