Пример #1
0
        public void GetUser()
        {
            // Arrange
            UsersController controller = new UsersController(repository);
            User user=new User();
            user.Login = "******";
            user.Password = "******";
            user.Name = "ololosha";
            user.userId=Guid.NewGuid();
            controller.Post(user);

            // Act

            User result = controller.Get("*****@*****.**","123456");

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("*****@*****.**", result.Login);
            Assert.AreEqual("ololosha", result.Name);
            Assert.AreEqual("123456", result.Password);
        }
Пример #2
0
        public void GetUsers()
        {
            // Arrange
            UsersController controller = new UsersController(repository);

            User user = new User();
            user.Login = "******";
            user.Password = "******";
            user.Name = "ololosha";
            user.userId = Guid.NewGuid();
            controller.Post(user);

            user.userId = Guid.NewGuid();
            controller.Post(user);

            user.userId = Guid.NewGuid();
            controller.Post(user);

            // Act
            IEnumerable<User> result = controller.Get();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(4, result.Count());
        }
Пример #3
0
        public void UserUpdate()
        {
            // Arrange
            UsersController controller = new UsersController(repository);
            User user = new User();
            user.Login = "******";
            user.Password = "******";
            user.Name = "ololosha";

            Guid current_guid = Guid.NewGuid();
            user.userId = current_guid;

            controller.Post(user);

            // Act

            user.Name = "IAmWinner";
            user.Password = "******";

            controller.Put(user);

            User result = controller.Get(current_guid);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("*****@*****.**", result.Login);
            Assert.AreEqual("IAmWinner", result.Name);
            Assert.AreEqual("z7vBA2a1", result.Password);
            Assert.AreEqual(current_guid, user.userId);
        }