Example #1
0
        public void EndingEpochTest()
        {
            Listing listing = new Listing();
            listing.EndingEpoch = 1;

            Assert.AreEqual(1, listing.EndingEpoch);
            Helper.AssertDateIs(listing.EndingDate.Value, 1970, 1, 1, 0, 0, 1);
        }
Example #2
0
        public void FavoriteCreationDateTest()
        {
            Listing listing = new Listing();
            listing.FavoriteCreationDate = new DateTime(1970, 1, 1);

            Assert.AreEqual(new DateTime(1970, 1, 1), listing.FavoriteCreationDate);
            Assert.AreEqual(0, listing.FavoriteCreationEpoch);
        }
        public void ListingViewModelCreateTest()
        {
            Listing listing = new Listing();
            ListingViewModel listingViewModel = new ListingViewModel(listing);

            Assert.IsNotNull(listingViewModel);
            Assert.IsNotNull(listingViewModel.Listing);
        }
Example #4
0
        public void EndingDateTest()
        {
            Listing listing = new Listing();
            listing.EndingDate = new DateTime(1970, 1, 1);

            Assert.AreEqual(new DateTime(1970, 1, 1), listing.EndingDate);
            Assert.AreEqual(0, listing.EndingEpoch);
        }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the ListingViewModel class
        /// </summary>
        /// <param name="listing">the listing Data transfer object</param>
        public ListingViewModel(Listing listing)
        {
            this.listing = listing;

            if (!string.IsNullOrEmpty(listing.CurrencyCode))
            {
                this.currencySymbol = CurrencySymbolLookup.CurrencySymbolFromCurrencyCode(listing.CurrencyCode);
            }
        }
        public void ListingViewModelCreateTest()
        {
            Listing listing = new Listing();
            listing.Quantity = 42;
            listing.Title = "fish";

            ListingViewModel viewModel = new ListingViewModel(listing);

            Assert.IsNotNull(viewModel);
            Assert.AreEqual(42, viewModel.Quantity);
            Assert.AreEqual("fish", viewModel.Title);
        }
Example #7
0
        /// <summary>
        /// Initializes a new instance of the ListingViewModel class
        /// </summary>
        /// <param name="listing">the listing Data transfer object</param>
        public ListingViewModel(Listing listing)
        {
            if (listing == null)
            {
                throw new ArgumentNullException("listing");
            }

            this.listing = listing;

            if (!string.IsNullOrEmpty(listing.CurrencyCode))
            {
                this.currencySymbol = CurrencySymbolLookup.CurrencySymbolFromCurrencyCode(listing.CurrencyCode);
            }

            this.WebLinkClickCommand = new HyperlinkNavigateCommand();
        }
Example #8
0
        /// <summary>
        /// Initializes a new instance of the ListingViewModel class
        /// </summary>
        /// <param name="listing">the listing data to show</param>
        public ListingViewModel(Listing listing)
        {
            this.title = listing.Title;
            this.thumbnailImageUrl = listing.ImageUrl155X125;
            this.currencyCode = listing.CurrencyCode;
            this.price = (decimal)listing.Price;
            this.created = listing.CreationDate;
            this.ending = listing.EndingDate;
            this.userName = listing.UserName;
            this.userId = listing.UserId;
            this.quantity = listing.Quantity;
            this.tags = listing.Tags.ToCsv();
            this.materials = listing.Materials.ToCsv();

            if (!string.IsNullOrEmpty(listing.CurrencyCode))
            {
                this.currencySymbol = Helpers.CurrencySymbolFromCurrencyCode(listing.CurrencyCode);
            }
        }
Example #9
0
        public void FavoriteCreationEpochTest()
        {
            Listing listing = new Listing();
            listing.FavoriteCreationEpoch = 1;

            Assert.AreEqual(1, listing.FavoriteCreationEpoch);
            Helper.AssertDateIs(listing.FavoriteCreationDate.Value, 1970, 1, 1, 0, 0, 1);
        }
Example #10
0
 public void ListingSimpleCreateTest()
 {
     Listing listing = new Listing();
     Assert.IsNotNull(listing);
 }
Example #11
0
        public void ListingSetStateExpiredTest()
        {
            Listing listing = new Listing();
            listing.State = "expired";

            Assert.AreEqual(ListingState.Expired, listing.StateEnum);
        }
Example #12
0
 public void ListingSetStateBadValueTest()
 {
     Listing listing = new Listing();
     listing.State = "goofy";
 }
Example #13
0
        public void ListingSetStateActiveTest()
        {
            Listing listing = new Listing();
            listing.State = "active";

            Assert.AreEqual(ListingState.Active, listing.StateEnum);
        }
Example #14
0
        public void ListingFavoriteCreationEpochNullTest()
        {
            Listing listing = new Listing();
            listing.FavoriteCreationEpoch = null;

            Assert.IsFalse(listing.FavoriteCreationDate.HasValue);
        }
Example #15
0
        public void ListingEndingEpochNullTest()
        {
            Listing listing = new Listing();
            listing.EndingEpoch = null;

            Assert.IsFalse(listing.EndingDate.HasValue);
        }
Example #16
0
        public void ListingDatesNullByDefaultTest()
        {
            Listing shop = new Listing();

            Assert.IsFalse(shop.CreationEpoch.HasValue);
            Assert.IsFalse(shop.CreationDate.HasValue);

            Assert.IsFalse(shop.FavoriteCreationEpoch.HasValue);
            Assert.IsFalse(shop.FavoriteCreationDate.HasValue);

            Assert.IsFalse(shop.EndingEpoch.HasValue);
            Assert.IsFalse(shop.EndingDate.HasValue);
        }