コード例 #1
0
ファイル: WebServiceTests.cs プロジェクト: nivertech/Olive
        public void CreateTransferWithBadArgumentsThrowsException(
            int sourceAccountId, int destAccountId, decimal amount, string description)
        {
            // Arrange
            var context = new Mock<IOliveContext>();
            this.container.RegisterInstance(context.Object);

            context.Setup(c => c.VerifySession(It.IsAny<Guid>())).Returns(1);

            IBankService service = new ClientService { Container = this.container };

            try
            {
                service.CreateTransfer(Guid.NewGuid(), sourceAccountId, destAccountId, amount, description);
            }
            catch (ArgumentException)
            {
                return;

                // Assert.Pass(string.Format("Source={0}; Dest={1}; Amount={2}; Desc={3}", sourceAccountId, destAccountId, amount, description));
            }
            catch
            {
                Assert.Fail("Unexpected exception");
            }

            Assert.Fail("Unsupported case did not throw exception.");
        }