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

            // Act
            Action act = () => carAdFactory
                         .WithMake("TestManufacturer")
                         .WithCategory("TestCategory", "TestDescription")
                         .Build();

            // Assert
            act.Should().Throw <InvalidCarAdException>();
        }
Example #2
0
        public void BuildShouldThrowExceptionIfCategoryIsNotSet()
        {
            // Assert
            var carAdFactory = new CarAdFactory();

            // Act
            Action act = () => carAdFactory
                         .WithMake("TestManufacturer")
                         .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 CreateAdShouldThrowIfCategoryIsNotSet()
        {
            // Arrange
            var carAdFactory = new CarAdFactory();

            // Act
            Action act = () => carAdFactory
                         .WithManufacturer("test")
                         .WithOptions(true, 4, TransmissionType.Manual)
                         .Build();

            // Assert
            act.Should().Throw <InvalidCarAdException>();
        }
Example #6
0
        public void BuildShouldCreateCarAdIfEveryPropertyIsSet()
        {
            // Assert
            var carAdFactory = new CarAdFactory();

            // Act
            var carAd = carAdFactory
                        .WithMake("TestManufacturer")
                        .WithCategory("TestCategory", "TestCategoryDescription")
                        .WithOptions(true, 2, TransmissionType.Automatic)
                        .WithImageUrl("http://test.image.url")
                        .WithModel("TestModel")
                        .WithPricePerDay(10)
                        .Build();

            // Assert
            carAd.Should().NotBeNull();
        }
        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();
        }