コード例 #1
0
        public async Task Create_TestIfExistingUser(bool usernameExists)
        {
            _moqRepoBase.Setup(a => a.Exists(It.IsAny <Expression <Func <EntityUser, bool> > >(), default)).Returns(Task.FromResult(usernameExists));
            _iBusinessUsers = new BusinessUsers(_imapper, _moqRepoBase.Object, _moqDataUsers.Object);

            var requestResult = await _iBusinessUsers.Create(_user, default);

            Assert.Equal(!usernameExists, requestResult.Succeeded);
            Assert.Equal(string.Empty, requestResult.Model?.Password ?? string.Empty);
        }
コード例 #2
0
        public async Task <IActionResult> Create(User user, CancellationToken cancellationToken)
        {
            var requestResult = await _iBusinessUsers.Create(user, cancellationToken);

            return(Created(requestResult));
        }