Esempio n. 1
0
        public void BuyerProfileBoxStatsViewModel_Should_Set_Properties_Correctly_With_CorrectData()
        {
            // Arrange
            var fullName      = "fullname";
            var initials      = "initials";
            var memberSince   = new DateTime(17, 1, 1);
            var balanceInKUsd = "1K";
            var balance       = 1m;
            var ownedDomains  = 1;

            var buyerProfileBoxStatsViewModel = new BuyerProfileBoxStatsViewModel()
            {
                FullName      = fullName,
                Initials      = initials,
                MemberSince   = memberSince,
                BalanceInKUsd = balanceInKUsd,
                Balance       = balance,
                OwnedDomains  = ownedDomains
            };

            // Act & Assert
            Assert.AreEqual(fullName, buyerProfileBoxStatsViewModel.FullName);
            Assert.AreEqual(initials, buyerProfileBoxStatsViewModel.Initials);
            Assert.AreEqual(memberSince, buyerProfileBoxStatsViewModel.MemberSince);
            Assert.AreEqual(balanceInKUsd, buyerProfileBoxStatsViewModel.BalanceInKUsd);
            Assert.AreEqual(balance, buyerProfileBoxStatsViewModel.Balance);
            Assert.AreEqual(ownedDomains, buyerProfileBoxStatsViewModel.OwnedDomains);
        }
Esempio n. 2
0
        public void ConstructorShouldCreate_BuyerProfileBoxStatsViewModel_WithoutParams()
        {
            // Act & Assert
            var buyerProfileBoxStatsViewModel = new BuyerProfileBoxStatsViewModel();

            Assert.IsInstanceOf <BuyerProfileBoxStatsViewModel>(buyerProfileBoxStatsViewModel);
        }
Esempio n. 3
0
        // GET: Buyer/Buyer
        public ActionResult Index()
        {
            var userId = this.loggedInUser.GetUserId();

            var user = this.userService.GetUserByStringId(userId);

            var buyerProfileBoxModel = new BuyerProfileBoxStatsViewModel()
            {
                FullName      = user.FirstName + " " + user.LastName,
                Initials      = user.FirstName[0].ToString() + user.LastName[0].ToString(),
                MemberSince   = user.CreatedOn,
                Balance       = user.Balance,
                BalanceInKUsd = Math.Round(user.Balance / 1000, 0) + "k",
                OwnedDomains  = this.domainService.GetBuyerOwnedDomainsByUserId(userId).Count()
            };

            return(View(buyerProfileBoxModel));
        }