Esempio n. 1
0
        public void Cannot_publish_without_text()
        {
            _classfiedAd.SetTitle(ClassfiedAdTitle.FromString("Test ad"));
            _classfiedAd.UpdatePrice(Price.FromDecimal(5, "USD", new FakeCurrencyLookup()));

            Assert.Throws <InvalidEntityStateException>(() => _classfiedAd.RequestToPublish());
        }
Esempio n. 2
0
        public void Cannot_publish_without_price()
        {
            _classfiedAd.SetTitle(ClassfiedAdTitle.FromString("Test ad"));
            _classfiedAd.UpdateText(ClassfiedAdText.FromString("Please buy my stuff"));

            Assert.Throws <InvalidEntityStateException>(() => _classfiedAd.RequestToPublish());
        }
Esempio n. 3
0
        public void Cannot_publish_with_zero_price()
        {
            _classfiedAd.SetTitle(ClassfiedAdTitle.FromString("Test ad"));
            _classfiedAd.UpdatePrice(Price.FromDecimal(0, "USD", new FakeCurrencyLookup()));
            _classfiedAd.UpdateText(ClassfiedAdText.FromString("Please buy my stuff"));

            Assert.Throws <InvalidEntityStateException>(() => _classfiedAd.RequestToPublish());
        }
Esempio n. 4
0
        public void Can_publish_a_valid_ad()
        {
            _classfiedAd.SetTitle(ClassfiedAdTitle.FromString("Test ad"));
            _classfiedAd.UpdateText(ClassfiedAdText.FromString("Please buy my stuff"));
            _classfiedAd.UpdatePrice(Price.FromDecimal(100.10m, "EUR", new FakeCurrencyLookup()));
            _classfiedAd.RequestToPublish();

            Assert.Equal(ClassfiedAd.ClassifiedAdState.PendingReview, _classfiedAd.State);
        }