Пример #1
0
        public void AddSubSiteCreationRequestTest()
        {
            MockConfigManager.ReturnValue = "http://localhost";
            SharePointServiceLocator.ReplaceCurrentServiceLocator(new ActivatingServiceLocator().RegisterTypeMapping <IHierarchicalConfig, MockConfigManager>());

            Hashtable farmProperties = new Hashtable(1);

            farmProperties.Add("SubSiteCreationConfigurationSite", "http://localhost");
            Isolate.WhenCalled(() => SPFarm.Local.Properties).WillReturn(farmProperties);

            SPSite fakeSite = Isolate.Fake.Instance <SPSite>(Members.ReturnRecursiveFakes);

            Isolate.Swap.NextInstance <SPSite>().With(fakeSite);

            SPWeb fakeWeb = Isolate.Fake.Instance <SPWeb>(Members.ReturnRecursiveFakes);

            Isolate.WhenCalled(() => fakeSite.OpenWeb()).WillReturn(fakeWeb);

            SPList     fakeList = fakeWeb.Lists["Sub Site Creation Requests"];
            SPListItem fakeItem = fakeList.Items.Add();

            SubSiteCreationRequestsRepository target  = new SubSiteCreationRequestsRepository();
            SubSiteCreationRequest            request = new SubSiteCreationRequest();

            request.BusinessEvent     = "unittest";
            request.EventId           = "0000";
            request.SiteCollectionUrl = "testurl";
            target.AddSubSiteCreationRequest(request);

            Isolate.Verify.WasCalledWithAnyArguments(() => fakeItem.Update());
        }
Пример #2
0
        public void AddSubSiteCreationRequestNullBusinessEventTest()
        {
            SubSiteCreationRequest request = new SubSiteCreationRequest();

            request.BusinessEvent = string.Empty;
            SubSiteCreationRequestsRepository target = new SubSiteCreationRequestsRepository();

            target.AddSubSiteCreationRequest(request);
        }
Пример #3
0
        public void AddSubSiteCreationRequestNullSiteCollectionUrTest()
        {
            SubSiteCreationRequest request = new SubSiteCreationRequest();

            request.BusinessEvent     = "UnitTest";
            request.EventId           = "UnitTest";
            request.SiteCollectionUrl = string.Empty;
            SubSiteCreationRequestsRepository target = new SubSiteCreationRequestsRepository();

            target.AddSubSiteCreationRequest(request);
        }
Пример #4
0
        public void AddSubSiteCreationRequestNullSubSiteCreationConfigurationSitePropertyTest()
        {
            MockConfigManager.ReturnValue = string.Empty;
            SharePointServiceLocator.ReplaceCurrentServiceLocator(new ActivatingServiceLocator().RegisterTypeMapping <IHierarchicalConfig, MockConfigManager>());

            Hashtable farmProperties = new Hashtable(0);

            Isolate.WhenCalled(() => SPFarm.Local.Properties).WillReturn(farmProperties);

            SubSiteCreationRequestsRepository target  = new SubSiteCreationRequestsRepository();
            SubSiteCreationRequest            request = new SubSiteCreationRequest();

            request.BusinessEvent     = "unittest";
            request.EventId           = "0000";
            request.SiteCollectionUrl = "testurl";
            target.AddSubSiteCreationRequest(request);
        }
Пример #5
0
        public void AddSubSiteCreationRequestParameterNullTest()
        {
            SubSiteCreationRequestsRepository target = new SubSiteCreationRequestsRepository();

            target.AddSubSiteCreationRequest(null);
        }