Beispiel #1
0
        public async Task When_Getting_Client_Then_Information_Are_Returned()
        {
            // ARRANGE
            const string clientId = "clientId";
            var          client   = new SimpleIdentityServer.Core.Common.Models.Client
            {
                ClientId = clientId
            };

            InitializeFakeObjects();
            _clientRepositoryStub.Setup(c => c.GetClientByIdAsync(It.IsAny <string>()))
            .Returns(Task.FromResult(client));

            // ACT
            var result = await _getClientAction.Execute(clientId);

            // ASSERTS
            Assert.NotNull(result);
            Assert.True(result.ClientId == clientId);
        }
        public async Task When_Deleting_Existing_Client_Then_Operation_Is_Called()
        {
            // ARRANGE
            const string clientId = "client_id";
            var          client   = new SimpleIdentityServer.Core.Common.Models.Client
            {
                ClientId = clientId
            };

            InitializeFakeObjects();
            _clientRepositoryStub.Setup(c => c.GetClientByIdAsync(It.IsAny <string>()))
            .Returns(Task.FromResult(client));
            _clientRepositoryStub.Setup(c => c.DeleteAsync(It.IsAny <SimpleIdentityServer.Core.Common.Models.Client>())).Returns(Task.FromResult(true));

            // ACT
            await _removeClientAction.Execute(clientId);

            // ASSERT
            _clientRepositoryStub.Verify(c => c.DeleteAsync(client));
        }