Example #1
0
        public void Init()
        {
            _returnUrl = "http://www.new_return_url.org";

            _service = new ReturnUrlService()
            {
                Configuration          = FakeConfigurationHelper.GetFakeConf(),
                RepositoriesFactory    = new FakeRepositoriesFactory(),
                StringLocalizerFactory = new FakeStringLocalizerFactory(),
                Logger = new FakeLogger()
            };

            _validUser = new User()
            {
                CreationDate = DateTime.Now,
                EMail        = "*****@*****.**",
                FullName     = "Testeur valide",
                Id           = 200,
                IsValid      = true,
                Password     = new byte[] { 0 },
                UserName     = "******"
            };

            _invalidUser = new User()
            {
                CreationDate = DateTime.Now,
                EMail        = "*****@*****.**",
                FullName     = "Testeur invalide",
                Id           = 201,
                IsValid      = false,
                Password     = new byte[] { 0 },
                UserName     = "******"
            };

            FakeDataBase.Instance.Users.Add(_invalidUser);
            FakeDataBase.Instance.Users.Add(_validUser);

            _validClient = new Client()
            {
                ClientSecret = "abc",
                ClientTypeId = 1,
                CreationDate = DateTime.Now,
                Description  = "",
                Id           = 300,
                IsValid      = true,
                Name         = "valid_client",
                PublicId     = "vc_pub_id"
            };

            _invalidClient = new Client()
            {
                ClientSecret = "abc",
                ClientTypeId = 1,
                CreationDate = DateTime.Now,
                Description  = "",
                Id           = 301,
                IsValid      = false,
                Name         = "invalid_client",
                PublicId     = "ic_pub_id"
            };

            FakeDataBase.Instance.Clients.Add(_validClient);
            FakeDataBase.Instance.Clients.Add(_invalidClient);

            FakeDataBase.Instance.UsersClient.Add(new UserClient()
            {
                ClientId     = _validClient.Id,
                CreationDate = DateTime.Now,
                Id           = 400,
                IsActif      = true,
                UserId       = _validUser.Id
            });

            FakeDataBase.Instance.UsersClient.Add(new UserClient()
            {
                ClientId     = _validClient.Id,
                CreationDate = DateTime.Now,
                Id           = 401,
                IsActif      = true,
                UserId       = _invalidUser.Id
            });

            FakeDataBase.Instance.UsersClient.Add(new UserClient()
            {
                ClientId     = _invalidClient.Id,
                CreationDate = DateTime.Now,
                Id           = 402,
                IsActif      = true,
                UserId       = _validUser.Id
            });

            FakeDataBase.Instance.UsersClient.Add(new UserClient()
            {
                ClientId     = _invalidClient.Id,
                CreationDate = DateTime.Now,
                Id           = 403,
                IsActif      = true,
                UserId       = _invalidUser.Id
            });
        }
Example #2
0
 public ReturnUrlController([FromServices] IReturnUrlService service)
 {
     _service = service;
 }