コード例 #1
0
        public void ShouldAddAnExtension()
        {
            //Arrange
            var extension  = A.Fake <IBootstrapperExtension>();
            var extensions = new BootstrapperExtensions();

            //Act
            extensions.Extension(extension);
            var result = extensions.GetExtensions();

            //Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(IList <IBootstrapperExtension>));
            Assert.AreEqual(1, result.Count);
            Assert.AreSame(extension, result[0]);
        }
コード例 #2
0
        public void ShouldHaveNoExtensions()
        {
            //Arrange
            var extensions = new BootstrapperExtensions();

            extensions.Extension(A.Fake <IBootstrapperExtension>());

            //Act
            extensions.ClearExtensions();
            var result = extensions.GetExtensions();

            //Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(IList <IBootstrapperExtension>));
            Assert.AreEqual(0, result.Count);
        }
コード例 #3
0
        public void ShouldReturnAReadOnlyListOfBoostraperExtensions()
        {
            //Arrange
            var extension    = A.Fake <IBootstrapperExtension>();
            var newExtension = A.Fake <IBootstrapperExtension>();
            var extensions   = new BootstrapperExtensions();

            extensions.Extension(extension);

            //Act
            var result = extensions.GetExtensions();

            //Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(IList <IBootstrapperExtension>));
            Assert.AreEqual(1, result.Count);
            ExceptionAssert.Throws <NotSupportedException>(() => result.Add(newExtension));
        }