public BookmarkContextTests()
        {
            fakeBookmarksContext = A.Fake <IBookmarksContext>();
            sut = new Browser(with =>
            {
                with.Dependency(fakeBookmarksContext);
                with.Module <BookmarkCollectionRepository>();
            });

            tagBundle = new TagBundle {
                Name = "linux"
            };
            //bookmarks = new Bookmark()
            //{
            //    Id = "57146c5f083989dcf1e69c4c"
            //    , LinkText = "LinuxCNC"
            //    , LinkUrl = "http://www.linuxcnc.org/"
            //    , Tags = new List<string>() { "cnc", "3dprinting", "linux", "opensource" }
            //};
        }
Exemplo n.º 2
0
        public void SetupContext()
        {
            string appConfigFilePath =
                @"C:\code\csharp-vs2013\TagSortService\BookmarkRepositoryUnitTest\app.config";

            Configuration config = ConfigurationManager.OpenExeConfiguration
                                       (ConfigurationUserLevel.None);

            AppDomain.CurrentDomain.SetData
                ("APP_CONFIG_FILE", appConfigFilePath);

            ConnectionStringsSection section =
                config.GetSection("connectionStrings")
                as ConnectionStringsSection;

            connectionString = section.ConnectionStrings[0].ConnectionString;

            if (context == null)
            {
                context = new Bookmarks.Mongo.Data.BookmarksContext(connectionString);
            }
        }
 public SocialAuthenticationCallbackProvider(IBookmarksContext bookmarkContext)
 {
     context = bookmarkContext;
 }
        public BookmarkCollectionRepository(IBookmarksContext bookmarkContext)
        {
            this.RequiresAuthentication();

            context = bookmarkContext;

            Get["/"] =
                _ => Response.AsRedirect("/Content/src/app/tagBundle/manageTagBundles.html#?bookmarksCollectionId=");

            Get["/termcounts/{bufferSize:int}"] =
                parameters => Response.AsJson(CalculateTermCounts((int)parameters.bufferSize));

            Get["/bookmarkCollections/"] = _ => Response.AsJson(GetBookmarkCollections());

            Get["/tagBundleNames/{bookmarksCollectionId}"] =
                parameters => Response.AsJson(GetTagBundleNames((string)parameters.bookmarksCollectionId));

            Get["/tagBundle/{id}"] =
                parameters => Response.AsJson(GetTagBundleById((string)parameters.id));

            Get["/NextMostFrequentTags/{id}/{limitTermCounts:int}/{exclTagBundles}"] =
                parameters => Response.AsJson(GetNextMostFrequentTags((string)parameters.id
                                                                      , (int)parameters.limitTermCounts
                                                                      , (string)parameters.exclTagBundles));

            Get["/AssociatedTerms/{tagBundleId}/{bufferSize}"] =
                parameters => Response.AsJson(GetAssociatedTerms((string)parameters.tagBundleId
                                                                 , (int)parameters.bufferSize));

            Post["/tagBundle/updateById"] = ctx =>
            {
                var tagBundle = this.Bind <ViewModels.TagBundle>();

                UpdateTagBundleById(new TagBundle
                {
                    Id = tagBundle.Id
                    ,
                    Name = tagBundle.Name
                    ,
                    Tags = MapTags(tagBundle.Tags)
                    ,
                    ExcludeTags = MapTags(tagBundle.ExcludeTags)
                    ,
                    ExcludeTagBundles = tagBundle.ExcludeTagBundles
                });

                return(HttpStatusCode.OK);
            };

            Post["/tagBundle/create"] = ctx =>
            {
                var tagBundle = this.Bind <TagBundle>();
                CreateTagBundle(tagBundle);
                return(HttpStatusCode.OK);
            };

            Post["/tagBundle/editName"] = ctx =>
            {
                var tagBundle = this.Bind <TagBundle>();
                UpdateTagBundleNameById(tagBundle);
                return(HttpStatusCode.OK);
            };

            Get["/bookmarksByTagBundle/{tagBundleName}/{skip}/{take}/"] =
                parameters => Response.AsJson(GetBookmarksByTagBundle((string)parameters.tagBundleName
                                                                      , (int)parameters.skip
                                                                      , (int)parameters.take));
        }
 public SecurityTests()
 {
     fakeBookmarksContext = A.Fake <IBookmarksContext>();
 }