コード例 #1
0
            public void ShouldAddSingleItem()
            {
                // Arrange
                var objectToAdd = new AlphaValidator {
                    Key = "AlphaOnly"
                };

                // Act
                var collection = new ValidatorCollection {
                    objectToAdd
                };

                // Assert
                collection.ShouldContain(objectToAdd);
            }
コード例 #2
0
            public void ShouldAddRangeOfItems()
            {
                // Arrange
                IEnumerable <IValidator> objectsToAdd = new List <IValidator>
                {
                    new AlphaValidator {
                        Key = "AlphaOnly"
                    },
                    new RequiredValidator {
                        Key = "Required"
                    },
                };

                var collection = new ValidatorCollection();

                // Act
                collection.AddRange(objectsToAdd);

                // Assert
                foreach (IValidator item in objectsToAdd)
                {
                    collection.ShouldContain(item);
                }
            }