示例#1
0
        public async Task UserClient_GetMoney_ToUserThatDoesExist_ReturnsMoney()
        {
            // arrange
            var amount = Rng.Next();

            var          channel = GetChannel();
            var          client  = new User.UserClient(channel);
            const string id      = "1";

            var addQuery = new UserMoneyQuery
            {
                Id     = id,
                Amount = amount
            };

            var getQuery = new UserQuery
            {
                Id = id
            };

            // act
            var addResult = await client.AddMoneyAsync(addQuery);

            var getResult = await client.GetMoneyAsync(getQuery);

            // assert
            Assert.AreEqual(Status.Success, addResult.Status, "AddMoney() failed.");
            Assert.AreEqual(Status.Success, getResult.Status, "GetMoney() failed.");
            Assert.AreEqual(amount, getResult.Amount);
        }
示例#2
0
        public async Task UserClient_GetMoney_ToUserThatDoesNotExist_ReturnsZero()
        {
            // arrange
            var channel = GetChannel();
            var client  = new User.UserClient(channel);

            var getQuery = new UserQuery
            {
                Id = "1"
            };

            // act
            var getResult = await client.GetMoneyAsync(getQuery);

            // assert
            Assert.AreEqual(Status.Success, getResult.Status, "GetMoney() failed.");
            Assert.AreEqual(0, getResult.Amount);
        }