public void CanReturnSpWebTemplateCollectionFromLcid()
        {
            //Arrange
            var  templateCollection = new SPWebTemplateCollectionSubstitute();
            uint lcid = 1033;

            //Act
            Sut.WebTemplates(lcid).Returns(templateCollection);

            //Assert
            using (var site = GetSite())
            {
                Assert.That(site.GetWebTemplates(lcid), Is.SameAs(templateCollection.SpType));
            }
        }
示例#2
0
        public void SubstituteTemplateCollectionAlsoSubstitutesSiteWithGuid()
        {
            //Arrange
            var spWebTemplateCollectionSubstitute = new SPWebTemplateCollectionSubstitute();

            var webTemplates = new List <SPWebTemplateSubstitute>();

            //Act
            spWebTemplateCollectionSubstitute.Returns(webTemplates);

            //Assert
            using (var site = new SPSite(new Guid()))
            {
                Assert.That(site, Is.Not.Null);
            }
        }
        public void CanReturnSpWebTemplateCollectionFromTwoDifferentLcid()
        {
            //Arrange
            var  templateCollectionOne = new SPWebTemplateCollectionSubstitute();
            uint lcidOne = 1033;

            var  templateCollectionTwo = new SPWebTemplateCollectionSubstitute();
            uint lcidTwo = 1034;

            //Act
            Sut.WebTemplates(lcidOne).Returns(templateCollectionOne);
            Sut.WebTemplates(lcidTwo).Returns(templateCollectionTwo);

            //Assert
            using (var site = GetSite())
            {
                Assert.That(site.GetWebTemplates(lcidOne), Is.SameAs(templateCollectionOne.SpType));
                Assert.That(site.GetWebTemplates(lcidTwo), Is.SameAs(templateCollectionTwo.SpType));
            }
        }
示例#4
0
        public void CanGetWebTemplateFromSubstituteTemplateCollection()
        {
            //Arrange
            var spWebTemplateCollectionSubstitute = new SPWebTemplateCollectionSubstitute();

            var webTemplate = new SPWebTemplateSubstitute();

            var template = new List <SPWebTemplateSubstitute>
            {
                webTemplate
            };

            //Act
            spWebTemplateCollectionSubstitute.Returns(template);

            //Assert
            using (var site = new SPSite("http://SomeURL"))
            {
                Assert.That(site.GetWebTemplates(1033), Contains.Item(webTemplate.SpType));
            }
        }
示例#5
0
 public void Returns(SPWebTemplateCollectionSubstitute templates)
 {
     _spSiteSubstitute.WebTemplateCollections[_lcid] = templates;
     _spSiteSubstitute.Actions.Add(site => DoMap());
 }