コード例 #1
0
        public void Build_ProtectedCtor_BuildsDefaultObject()
        {
            // Arrange
            FerrariBuilder builder = new FerrariBuilder();

            // Act
            Car actual = builder.Build();

            // Assert
            Assert.NotNull(actual);

            new
            {
                Color    = Car.DefaultColor,
                NumDoors = default(int),
                Model    = Car.DefaultModel
            }.ToExpectedObject().ShouldMatch(actual);
        }
コード例 #2
0
        public void Build_WithModifications_BuildsModifiedObject()
        {
            // Arrange
            FerrariBuilder builder = new FerrariBuilder()
                                     .WithColor(Color.Red)
                                     .WithNumDoors(NumDoors);

            // Act
            Car actual = builder.Build();

            // Assert
            Assert.NotNull(actual);

            new
            {
                Color = Color.Red.Name,
                NumDoors,
                Model = Car.DefaultModel
            }.ToExpectedObject().ShouldMatch(actual);
        }