コード例 #1
0
        public void BuildShouldThrowExceptionIfOptionsAreNotSet()
        {
            // Assert
            var apartmentAdFactory = new ApartmentAdFactory();

            // Act
            Action act = () => apartmentAdFactory
                         .WithNeighborhood("TestNeighborhood")
                         .WithCategory("TestCategory", "TestDescription")
                         .Build();

            // Assert
            act.Should().Throw <InvalidApartmentAdException>();
        }
コード例 #2
0
        public void BuildShouldThrowExceptionIfCategoryIsNotSet()
        {
            // Assert
            var apartmentAdFactory = new ApartmentAdFactory();

            // Act
            Action act = () => apartmentAdFactory
                         .WithNeighborhood("TestNeighborhood")
                         .WithOptions(true, true, HeatingType.Еlectricity)
                         .Build();

            // Assert
            act.Should().Throw <InvalidApartmentAdException>();
        }
コード例 #3
0
        public void BuildShouldCreateApartmentAdIfEveryPropertyIsSet()
        {
            // Assert
            var apartmentAdFactory = new ApartmentAdFactory();

            // Act
            var apartmentAd = apartmentAdFactory
                              .WithNeighborhood("TestNeighborhood")
                              .WithCategory(CategoryFakes.ValidCategoryName, "TestCategoryDescription")
                              .WithOptions(true, true, HeatingType.Еlectricity)
                              .WithImageUrl("http://test.image.url")
                              .WithFloor(10)
                              .WithPricePerMonth(1000)
                              .Build();

            // Assert
            apartmentAd.Should().NotBeNull();
        }