public void Update_User_Client_With_Is_Actif_False_Should_Update()
        {
            AddUserClientForValidUserAndValidClientIfMissing();

            _service.UpdateUserClient(new DTO.UpdateUserClientDto()
            {
                UserName       = _validUser.UserName,
                ClientPublicId = _validClient.PublicId,
                IsActif        = true
            });

            var myUc = _repo.GetUserClientByClientPublicIdAndUserName(_validClient.PublicId, _validUser.UserName);

            Assert.IsNotNull(myUc);
            Assert.IsTrue(myUc.IsActif);

            _service.UpdateUserClient(new DTO.UpdateUserClientDto()
            {
                UserName       = _validUser.UserName,
                ClientPublicId = _validClient.PublicId,
                IsActif        = false
            });

            myUc = _repo.GetUserClientByClientPublicIdAndUserName(_validClient.PublicId, _validUser.UserName);
            Assert.IsNotNull(myUc);
            Assert.IsFalse(myUc.IsActif);
        }
Beispiel #2
0
        public void Create_New_Client_Should_Create_A_Creator_User_Client()
        {
            var name        = Guid.NewGuid().ToString();
            var description = Guid.NewGuid().ToString();
            var userName    = _validUserCreator.UserName;

            var id = _service.CreateClient(new DTO.CreateClientDto()
            {
                ClientType = ClientTypeName.Confidential,
                ReturnUrls = new List <string>()
                {
                    "http://www.perdu.com"
                },
                Name        = name,
                UserName    = userName,
                Description = description
            });

            Assert.IsTrue(id > 0);

            var client = _repo.GetById(id);

            Assert.IsNotNull(client);

            var ucrepo = new FakeUserClientRepository();
            var myUc   = ucrepo.GetUserClientByClientPublicIdAndUserName(client.PublicId, userName);

            Assert.IsNotNull(myUc);
            Assert.IsTrue(myUc.Client.UserCreator.UserName.Equals(userName));
        }