示例#1
0
        public FullUserView GetAllData(User user)
        {
            if (user == null)
            {
                return(null);
            }

            FullUserView fullUserView = new FullUserView();

            fullUserView.Id         = user.Id;
            fullUserView.Username   = user.UserName;
            fullUserView.FirstName  = user.FirstName;
            fullUserView.MiddleName = user.MiddleName != null ? user.MiddleName : "Empty";
            fullUserView.LastName   = user.LastName;
            fullUserView.BooksCount = db.UsersBooks
                                      .Where(ub => ub.UserId == user.Id)
                                      .Count();

            Contact contact = FindUserContact(user);

            if (contact != null)
            {
                fullUserView.Email = contact.Email != null ? contact.Email : "Empty";
                fullUserView.Phone = contact.Phone != null ? contact.Phone : "Empty";
            }
            else
            {
                fullUserView.Email = "Empty";
                fullUserView.Phone = "Empty";
            }

            return(fullUserView);
        }
        public void IsNullWhenUsersIsNull()
        {
            User user = null;

            FullUserView view = userServices.GetAllData(user);

            Assert.AreEqual(view, null);
        }
示例#3
0
    /// <summary>
    /// uses BlockingOperationManager, Controller, FullUserView
    /// </summary>
    public void ShowFullInfo()
    {
        followButton.interactable = false;

        FullUserView.Show(Id == Repository.I.PersonalFullInfo.Id
            ? Repository.I.PersonalFullInfo
            : fullUserInfo);
    }
示例#4
0
 public override void ShowFullInfo()
 {
     if (Id == Repository.I.PersonalFullInfo.Id)
     {
         FullUserView.Show(Repository.I.PersonalFullInfo);
     }
     else
     {
         var oppoFullInfo = RoomSettings.I.UserInfos.FirstOrDefault(_ => _.Id == Id);
         FullUserView.Show(oppoFullInfo);
     }
 }
        public void IsGettingCorrectDataAboutUsersWhenUserHasNoContacts()
        {
            User user = db.Users.FirstOrDefault(u => u.Id == 3);

            FullUserView view = userServices.GetAllData(user);

            Assert.AreEqual(view.Username, "vladsto2");
            Assert.AreEqual(view.FirstName, "Vladimir2");
            Assert.AreEqual(view.MiddleName, "Empty");
            Assert.AreEqual(view.LastName, "Stoyanov2");
            Assert.AreEqual(view.BooksCount, 0);
            Assert.AreEqual(view.Email, "Empty");
            Assert.AreEqual(view.Phone, "Empty");
        }
        public void IsGettingCorrectDataAboutUsers()
        {
            User user = db.Users.FirstOrDefault(u => u.Id == 1);

            FullUserView view = userServices.GetAllData(user);

            Assert.AreEqual(view.Username, "vladsto");
            Assert.AreEqual(view.FirstName, "Vladimir");
            Assert.AreEqual(view.MiddleName, "Empty");
            Assert.AreEqual(view.LastName, "Stoyanov");
            Assert.AreEqual(view.BooksCount, 0);
            Assert.AreEqual(view.Email, "*****@*****.**");
            Assert.AreEqual(view.Phone, "0123456789");
        }
示例#7
0
    public static void Show(FullUserInfo fullUserInfo)
    {
        UniTask.Create(async() =>
        {
            var key = (fullUserInfo is PersonalFullUserInfo) ? "personalFuv" : "fullUserView";

            if (!activeInstance)
            {
                activeInstance = await Create(key);
            }
            else if (activeInstance.FullUserInfo.GetType() != fullUserInfo.GetType())
            {
                activeInstance.Destroy();
                activeInstance = await Create(key);
            }

            activeInstance.Init(fullUserInfo);
        });
    }
示例#8
0
 public override void ShowFullInfo()
 {
     FullUserView.Show(Repository.I.PersonalFullInfo);
 }