Пример #1
0
        public void GetAll_WrongItemPassed_ShouldThrowException([Content] Data.Items.Item item)
        {
            var    repository = new MapPointRepository();
            Action a          = () => repository.GetAll(item);

            a.ShouldThrow <ArgumentException>();
        }
Пример #2
0
        public void GetAll_WrongItemPassed_ShouldThrowException([FakeDb.AutoFixture.Content] Data.Items.Item item, [Frozen] Foundation.Indexing.Repositories.ISearchServiceRepository searchServiceRepository)
        {
            var    repository = new MapPointRepository(searchServiceRepository);
            Action a          = () => repository.GetAll(item);

            a.ShouldThrow <ArgumentException>();
        }
Пример #3
0
        public void GetAll_NullPassed_ShouldThrowArgumentNullException([Frozen] Foundation.Indexing.Repositories.ISearchServiceRepository searchServiceRepository)
        {
            var    repository = new MapPointRepository(searchServiceRepository);
            Action a          = () => repository.GetAll(null);

            a.ShouldThrow <ArgumentNullException>();
        }
Пример #4
0
        public void GetAll_NullPassed_ShouldThrowArgumentNullException()
        {
            var    repository = new MapPointRepository();
            Action a          = () => repository.GetAll(null);

            a.ShouldThrow <ArgumentNullException>();
        }
Пример #5
0
 public void GetAll_PointItemPassed_ShouldReturnSinglePoint(Db db)
 {
   var itemid = ID.NewID;
   db.Add(new DbItem("point", itemid, Templates.MapPoint.ID) { { Templates.MapPoint.Fields.Name, "nameField" } });
   var repository = new MapPointRepository();
   var actual = repository.GetAll(db.GetItem(itemid));
   actual.Single().Name.Should().Be("nameField");
 }
Пример #6
0
 public void GetAll_PointFolderItemPassed_ShouldCallSearchService(Db db,Foundation.Indexing.Repositories.ISearchServiceRepository searchRepo, [Substitute]Foundation.Indexing.SearchService service)
 {
   var itemid = ID.NewID;
   db.Add(new DbItem("point", itemid, Templates.MapPointsFolder.ID));
   searchRepo.Get().Returns(service);
   var repository = new MapPointRepository(searchRepo);
   repository.GetAll(db.GetItem(itemid));
   service.FindAll().Received(1);
 }
Пример #7
0
        public void GetAll_PointFolderItemPassed_ShouldCallSearchService(Db db, Foundation.Indexing.Repositories.ISearchServiceRepository searchRepo, [Substitute] Foundation.Indexing.SearchService service)
        {
            var itemid = ID.NewID;

            db.Add(new DbItem("point", itemid, Templates.MapPointsFolder.ID));
            searchRepo.Get().Returns(service);
            var repository = new MapPointRepository(searchRepo);

            repository.GetAll(db.GetItem(itemid));
            service.FindAll().Received(1);
        }
Пример #8
0
        public void GetAll_PointItemPassed_ShouldReturnSinglePoint(Db db, [Frozen] Foundation.Indexing.Repositories.ISearchServiceRepository searchServiceRepository)
        {
            var itemid = ID.NewID;

            db.Add(new DbItem("point", itemid, Templates.MapPoint.ID)
            {
                { Templates.MapPoint.Fields.MapPointName, "nameField" }
            });
            var repository = new MapPointRepository(searchServiceRepository);
            var actual     = repository.GetAll(db.GetItem(itemid));

            actual.Single().Name.Should().Be("nameField");
        }
Пример #9
0
        public void GetAll_PointItemPassed_ShouldReturnSinglePoint(Db db)
        {
            var itemid = ID.NewID;

            db.Add(new DbItem("point", itemid, Templates.MapPoint.ID)
            {
                { Templates.MapPoint.Fields.Name, "nameField" }
            });
            var repository = new MapPointRepository();
            var actual     = repository.GetAll(db.GetItem(itemid));

            actual.Single().Name.Should().Be("nameField");
        }
Пример #10
0
    public void GetAll_PointFolderItemPassed_ShouldReturnsItemsFromSearchService([Content]Data.Items.Item[] items,Db db, Foundation.Indexing.Repositories.ISearchServiceRepository searchRepo, [Substitute]Foundation.Indexing.SearchService service, Foundation.Indexing.Models.ISearchResults results, Foundation.Indexing.Models.ISearchResult result)
    {
      var itemid = ID.NewID;
      db.Add(new DbItem("point", itemid, Templates.MapPointsFolder.ID));
      searchRepo.Get().Returns(service);
      service.FindAll().Returns(results);
      var searchResutls = items.Select(x =>
      {
        var sr = Substitute.For<Foundation.Indexing.Models.ISearchResult>();
        sr.Item.Returns(x);
        return sr;
      });

      results.Results.Returns(searchResutls);

      var repository = new MapPointRepository(searchRepo);
      var actual = repository.GetAll(db.GetItem(itemid));
      actual.Count().Should().Be(items.Length);
    }
Пример #11
0
        public void GetAll_PointFolderItemPassed_ShouldReturnsItemsFromSearchService([Content] Data.Items.Item[] items, Db db, Foundation.Indexing.Repositories.ISearchServiceRepository searchRepo, [Substitute] Foundation.Indexing.SearchService service, Foundation.Indexing.Models.ISearchResults results, Foundation.Indexing.Models.ISearchResult result)
        {
            var itemid = ID.NewID;

            db.Add(new DbItem("point", itemid, Templates.MapPointsFolder.ID));
            searchRepo.Get().Returns(service);
            service.FindAll().Returns(results);
            var searchResutls = items.Select(x =>
            {
                var sr = Substitute.For <Foundation.Indexing.Models.ISearchResult>();
                sr.Item.Returns(x);
                return(sr);
            });

            results.Results.Returns(searchResutls);

            var repository = new MapPointRepository(searchRepo);
            var actual     = repository.GetAll(db.GetItem(itemid));

            actual.Count().Should().Be(items.Length);
        }
Пример #12
0
 public void GetAll_WrongItemPassed_ShouldThrowException([Content]Data.Items.Item item)
 {
   var repository = new MapPointRepository();
   Action a = () => repository.GetAll(item);
   a.ShouldThrow<ArgumentException>();
 }
Пример #13
0
 public void GetAll_NullPassed_ShouldThrowArgumentNullException()
 {
   var repository = new MapPointRepository();
   Action a = () => repository.GetAll(null);
   a.ShouldThrow<ArgumentNullException>();
 }