Exemple #1
0
        public void BuildShouldThrowExceptionIfManufacturerIsNotSet()
        {
            // Assert
            var carAdFactory = new CarAdFactory();

            // Act
            Action act = () => carAdFactory
                         .WithCategory("TestCategory", "TestDescription")
                         .WithOptions(true, 2, TransmissionType.Automatic)
                         .Build();

            // Assert
            act.Should().Throw <InvalidCarAdException>();
        }
        public void CreateAdShouldThrowIfOptionIsNotSet()
        {
            // Arrange
            var carAdFactory = new CarAdFactory();

            // Act
            Action act = () => carAdFactory
                         .WithCategory("Economy", "test descr")
                         .WithManufacturer("test")
                         .Build();

            // Assert
            act.Should().Throw <InvalidCarAdException>();
        }
        public void CreateAdShouldThrowIfManufacturerIsNotSet()
        {
            // Arrange
            var carAdFactory = new CarAdFactory();

            // Act
            Action act = () => carAdFactory
                         .WithCategory("Economy", "test descr")
                         .WithOptions(true, 3, TransmissionType.Automatic)
                         .Build();

            // Assert
            act.Should().Throw <InvalidCarAdException>();
        }
        public void CreateAdShouldPassIfAllPropertiesAreSet()
        {
            // Arrange
            var carAdFactory = new CarAdFactory();

            // Act
            var carAd = carAdFactory
                        .WithCategory("Economy", "test descr")
                        .WithOptions(true, 2, TransmissionType.Automatic)
                        .WithManufacturer("test")
                        .WithImageUrl("test.com")
                        .WithModel("model")
                        .WithPricePerDay(2.10m)
                        .Build();

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