Beispiel #1
0
        public void GetAllShouldReturnAllUser()
        {
            var options = new DbContextOptionsBuilder <ExpensesDbContext>()
                          .UseInMemoryDatabase(databaseName: nameof(GetAllShouldReturnAllUser))
                          .Options;

            using (var context = new ExpensesDbContext(options))
            {
                var usersService = new UserService(context, config);
                var added1       = new RegisterUserPostDto

                {
                    FullName = "codruta1",

                    Email    = "*****@*****.**",
                    Username = "******",
                    Password = "******"
                };
                var added2 = new RegisterUserPostDto

                {
                    FullName = "codruta3",

                    Email    = "*****@*****.**",
                    Username = "******",

                    Password = "******"
                };

                usersService.Register(added1);
                usersService.Register(added2);

                int numberOfElements = usersService.GetAll().Count();

                Assert.NotZero(numberOfElements);
            }
        }
Beispiel #2
0
        public void GetAllShouldReturnAllUser()
        {
            var options = new DbContextOptionsBuilder <AppDbContext>()
                          .UseInMemoryDatabase(databaseName: nameof(GetAllShouldReturnAllUser))
                          .Options;

            using (var context = new AppDbContext(options))
            {
                var usersService = new UserService(context, config);
                var added1       = new RegisterPostModel

                {
                    FirstName = "alina",
                    LastName  = "demian",
                    Username  = "******",
                    Email     = "*****@*****.**",
                    Password  = "******"
                };
                var added2 = new RegisterPostModel

                {
                    FirstName = "alina",
                    LastName  = "demian",
                    Username  = "******",
                    Email     = "*****@*****.**",
                    Password  = "******"
                };

                usersService.Register(added1);
                usersService.Register(added2);

                int numberOfElements = usersService.GetAll().Count();

                Assert.NotZero(numberOfElements);
                Assert.AreEqual(2, numberOfElements);
            }
        }