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); }
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); }
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); }
/// <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); }
/// <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(); }
/// <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); } }
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); }
public void ListingSimpleCreateTest() { Listing listing = new Listing(); Assert.IsNotNull(listing); }
public void ListingSetStateExpiredTest() { Listing listing = new Listing(); listing.State = "expired"; Assert.AreEqual(ListingState.Expired, listing.StateEnum); }
public void ListingSetStateBadValueTest() { Listing listing = new Listing(); listing.State = "goofy"; }
public void ListingSetStateActiveTest() { Listing listing = new Listing(); listing.State = "active"; Assert.AreEqual(ListingState.Active, listing.StateEnum); }
public void ListingFavoriteCreationEpochNullTest() { Listing listing = new Listing(); listing.FavoriteCreationEpoch = null; Assert.IsFalse(listing.FavoriteCreationDate.HasValue); }
public void ListingEndingEpochNullTest() { Listing listing = new Listing(); listing.EndingEpoch = null; Assert.IsFalse(listing.EndingDate.HasValue); }
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); }