示例#1
0
 public void ListOfUsers_WhenUserIsAddedToAnEmptyListListContainsOneUser()
 {
     User user = new User("Janko");
     ListOfUsers listOfUsers = new ListOfUsers();
     listOfUsers.Add(user);
     Assert.AreEqual(1, listOfUsers.UserCount);
 }
示例#2
0
文件: Review.cs 项目: vitoth/Zav
 public Review(User user, string text, Movie movie)
 {
     this.text = text;
     this.user = user;
     this.movie = movie;
     //Prilikom stvaranje recenzije, konstruktoru recenzije treba proslijediti 
     //registriranog korisnika,referencu na film te tekst recenzije
 }
示例#3
0
 public void ListOfUsers_WhenUserIsAddedHeIsInTheList()
 {
     ListOfUsers list = new ListOfUsers();
     string username = "******";
     User user = new User(username);
     list.Add(user);
     Assert.IsTrue(list.Contains(username));
 }
示例#4
0
        public void ListOfUsers_WhenUserIsAddedListIncreasesByOne()
        {
            ListOfUsers list = new ListOfUsers();
            Assert.AreEqual(0, list.UserCount);
            User user = new User("Janko");
            list.Add(user);
            Assert.AreEqual(1, list.UserCount);

        }
示例#5
0
文件: ListOfUsers.cs 项目: vitoth/Zav
        public bool Add(User user)
        {

            //AkoUListuPokušamoDodatiKorisnikaSImenomKojeVećPostojiListaSeNećePromijeniti 
            if (Contains(user.userName))
                return false;
            
            listOfUsers.Add(user);
            return true;
        }
示例#6
0
文件: Review.cs 项目: vitoth/Zav
        public bool ChangeText(string changedText, User user)
        {
            if (user.userName.Equals(this.user.userName))
            {
                text = changedText;
                return true;
            }
            return false;

        }
示例#7
0
        public void ListOfUsers_AddMethodReturnsFalseIfUsernameAlreadyExists()
        {
            ListOfUsers list = new ListOfUsers();
            User user = new User("Janko");

            Assert.IsTrue(list.Add(user));
            user = new User("Janko");
            
            Assert.IsFalse(list.Add(user));
            Assert.AreEqual(1, list.UserCount);
        }