예제 #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);
        }
예제 #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);
        }
예제 #3
0
        public void ListingViewModelCreateTest()
        {
            Listing listing = new Listing();
            ListingViewModel listingViewModel = new ListingViewModel(listing);

            Assert.IsNotNull(listingViewModel);
            Assert.IsNotNull(listingViewModel.Listing);
        }
예제 #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);
        }
예제 #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);
            }
        }
예제 #6
0
        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);
        }
예제 #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();
        }
예제 #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);
            }
        }
예제 #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);
        }
예제 #10
0
 public void ListingSimpleCreateTest()
 {
     Listing listing = new Listing();
     Assert.IsNotNull(listing);
 }
예제 #11
0
        public void ListingSetStateExpiredTest()
        {
            Listing listing = new Listing();
            listing.State = "expired";

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

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

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

            Assert.IsFalse(listing.EndingDate.HasValue);
        }
예제 #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);
        }