Пример #1
0
        public void Constructor_WithoutProperties_FillInModel()
        {
            // Given
            BaseAd ad = new Ad();
            ad.Body = "body";
            ad.Title = "title";
            ad.PhoneNumber = "78.85.75";
            ad.Price = 2000;
            ad.Category = new Bea.Domain.Categories.Category { Id = 12 };
            ad.City = new Bea.Domain.Location.City { Id = 11, Province = new Bea.Domain.Location.Province { Id = 13 } };
            ad.CreatedBy = new User { Email = "*****@*****.**", Firstname = "Nico" };
            // When
            AdCreateModel actual = new AdCreateModel(ad);

            // Then
            Assert.AreEqual("body", actual.Body);
            Assert.AreEqual("title", actual.Title);
            Assert.AreEqual("78.85.75", actual.Telephone);
            Assert.AreEqual(2000, actual.Price);
            Assert.AreEqual(12, actual.SelectedCategoryId);
            Assert.AreEqual(11, actual.SelectedCityId);
            Assert.AreEqual(13, actual.SelectedProvinceId);
            Assert.AreEqual("*****@*****.**", actual.Email);
            Assert.AreEqual("Nico", actual.Name);
        }
Пример #2
0
        public void Constructor_SetIsOfferToTrue()
        {
            // When
            AdCreateModel actual = new AdCreateModel();

            // Then
            Assert.IsTrue(actual.IsOffer);
        }
Пример #3
0
        public void Constructor_WithoutImages_LeaveImageIdsAsNull()
        {
            // Given
            BaseAd ad = new Ad();

            // When
            AdCreateModel actual = new AdCreateModel(ad);

            // Then
            Assert.AreEqual(String.Empty, actual.ImageIds);
        }
Пример #4
0
        public void Constructor_With2Images_ConcatImageIds()
        {
            // Given
            BaseAd ad = new Ad();
            ad.AddImage(new AdImage() { Id = Guid.Parse("e9da8b1e-aa77-401b-84e0-a1290130b7b7") });
            ad.AddImage(new AdImage() { Id = Guid.Parse("e9da8b1e-aa77-401b-84e0-a1290130b7b9") });

            // When
            AdCreateModel actual = new AdCreateModel(ad);

            // Then
            Assert.AreEqual("e9da8b1e-aa77-401b-84e0-a1290130b7b7;e9da8b1e-aa77-401b-84e0-a1290130b7b9;", actual.ImageIds);
        }