Пример #1
0
        public void Cannot_publish_without_title()
        {
            _classfiedAd.UpdatePrice(Price.FromDecimal(5, "EUR", new FakeCurrencyLookup()));
            _classfiedAd.UpdateText(ClassfiedAdText.FromString("Please by my stuff"));

            Assert.Throws <InvalidEntityStateException>(() => _classfiedAd.RequestToPublish());
        }
Пример #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());
        }
Пример #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());
        }
Пример #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);
        }