public static async Task <UsersRepository> GetInstance()
        {
            // Create and initialize an instance only once
            if (instance == null)
            {
                instance = instance ?? new UsersRepository();

                instance.Users = (await UsersServiceHelper.Get()).ToList();
            }

            return(instance);
        }
Exemple #2
0
        public async void VerifyGetById()
        {
            // Arrange
            const string expectedName  = "Chelsey Dietrich";
            const string expectedEmail = "*****@*****.**";

            // Act
            var user = await UsersServiceHelper.Get(UserId);

            // Assert
            Assert.AreEqual(expectedName, user.Name);
            Assert.AreEqual(expectedEmail, user.Email);
        }
Exemple #3
0
        public async void VerifyUpdate()
        {
            // Arrange
            const string expectedName = "New name";
            var          user         = await UsersServiceHelper.Get(UserId);

            // Act
            // Update name of the user and then get the user again from the API
            user.Name = expectedName;
            await UsersServiceHelper.Update(user);

            user = await UsersServiceHelper.Get(UserId);

            // Assert
            // Check if the name of user was indeed updated
            Assert.AreEqual(expectedName, user.Name);
        }
Exemple #4
0
 private async Task <int> GetUserCount()
 {
     return((await UsersServiceHelper.Get()).Count());
 }