Beispiel #1
0
            public void AnyCall_CallsCacheRepositoryAddItem()
            {
                // arrange
                var             mockDependents = new MockDependents();
                ICacheListLogic testunit       = MakeTestsLogic(false, ref mockDependents);
                var             testContext    = new UserSelectedContext
                {
                    BranchId   = "FUT",
                    CustomerId = "234567"
                };
                var testtype       = ListType.Contract;
                var lists          = new List <ListModel>();
                var testHeaderOnly = false;

                // act
                testunit.AddCachedTypedLists(testContext, testtype, testHeaderOnly, lists);

                // assert
                mockDependents.CacheRepository.Verify(m => m.AddItem(It.IsAny <string>(),
                                                                     It.IsAny <string>(),
                                                                     It.IsAny <string>(),
                                                                     It.IsAny <string>(),
                                                                     It.IsAny <TimeSpan>(),
                                                                     It.IsAny <List <ListModel> >()), Times.Once, "not called");
            }
Beispiel #2
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="cacheRepository"></param>
 /// <param name="profileLogic"></param>
 /// <param name="elRepo"></param>
 public CacheController(ICacheRefreshRepository cacheRepository, IUserProfileLogic profileLogic, IEventLogRepository elRepo,
                        IListService listService, ICacheListLogic cacheListLogic) : base(profileLogic)
 {
     this.cacheRepository = cacheRepository;
     _listService         = listService;
     _cacheListLogic      = cacheListLogic;
     this._elRepo         = elRepo;
 }
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="profileLogic"></param>
 /// <param name="importLogic"></param>
 /// <param name="logRepo"></param>
 public ImportController(IUserProfileLogic profileLogic, IImportLogic importLogic, IEventLogRepository logRepo, IImportService importService,
                         IListService listService, ICacheListLogic cacheListLogic)
     : base(profileLogic)
 {
     _listService     = listService;
     _importService   = importService;
     this.importLogic = importLogic;
     _log             = logRepo;
     _cacheListLogic  = cacheListLogic;
 }
Beispiel #4
0
 /// <summary>
 /// ctor
 /// </summary>
 /// <param name="profileLogic"></param>
 /// <param name="listLogic"></param>
 /// <param name="exportSettingsLogic"></param>
 /// <param name="elRepo"></param>
 /// <param name="auditLogRepo"></param>
 /// <param name="listRepo"></param>
 public ListController(IUserProfileLogic profileLogic, IExportSettingLogic exportSettingsLogic, ICacheListLogic cacheListLogic, ICatalogLogic catalogLogic,
                       IEventLogRepository elRepo, IAuditLogRepository auditLogRepo, ICustomListSharesRepository customListSharesRepo, IListService listService)
     : base(profileLogic)
 {
     _auditLogRepo         = auditLogRepo;
     _cacheListLogic       = cacheListLogic;
     _profileLogic         = profileLogic;
     _exportLogic          = exportSettingsLogic;
     _elRepo               = elRepo;
     _listService          = listService;
     _customListSharesRepo = customListSharesRepo;
     _catalogLogic         = catalogLogic;
 }
Beispiel #5
0
            public void AnyCall_CallsCacheRepositoryGetItem()
            {
                // arrange
                var             mockDependents = new MockDependents();
                ICacheListLogic testunit       = MakeTestsLogic(false, ref mockDependents);
                var             testContext    = new UserSelectedContext
                {
                    BranchId   = "FUT",
                    CustomerId = "234567"
                };

                // act
                List <string> results = testunit.GetCachedLabels(testContext);

                // assert
                mockDependents.CacheRepository.Verify(
                    m => m.GetItem <List <string> >(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(),
                                                    It.IsAny <string>()), Times.Once, "not called");
            }
Beispiel #6
0
            public void AnyCall_CallsCacheRepositoryRemoveTimes()
            {
                // arrange
                var             mockDependents = new MockDependents();
                ICacheListLogic testunit       = MakeTestsLogic(false, ref mockDependents);
                var             testContext    = new UserSelectedContext
                {
                    BranchId   = "FUT",
                    CustomerId = "234567"
                };

                // act
                testunit.ClearCustomersLabelsCache(testContext.CustomerId, testContext.BranchId);

                // assert
                mockDependents.CacheRepository.Verify(m => m.RemoveItem(It.IsAny <string>(),
                                                                        It.IsAny <string>(),
                                                                        It.IsAny <string>(),
                                                                        It.IsAny <string>()), Times.Once, "not called");
            }
Beispiel #7
0
            public void CallWithGoodType_CallsCacheRepositoryRemoveItemTwice()
            {
                // arrange
                var             mockDependents = new MockDependents();
                ICacheListLogic testunit       = MakeTestsLogic(false, ref mockDependents);
                var             testContext    = new UserSelectedContext
                {
                    BranchId   = "FUT",
                    CustomerId = "234567"
                };
                var testListType = ListType.Custom;

                // act
                testunit.RemoveTypeOfListsCache(testContext, testListType);

                // assert
                mockDependents.CacheRepository.Verify(m => m.RemoveItem(It.IsAny <string>(),
                                                                        It.IsAny <string>(),
                                                                        It.IsAny <string>(),
                                                                        It.IsAny <string>()), Times.Exactly(2), "not called");
            }
Beispiel #8
0
            public void CallWithGoodList_CallsCacheRepositoryRemoveItemOnce()
            {
                // arrange
                var             mockDependents = new MockDependents();
                ICacheListLogic testunit       = MakeTestsLogic(false, ref mockDependents);
                var             testList       = new ListModel
                {
                    BranchId       = "FUT",
                    CustomerNumber = "123456",
                    Type           = ListType.Contract,
                    ListId         = 5
                };

                // act
                testunit.RemoveSpecificCachedList(testList);

                // assert
                mockDependents.CacheRepository.Verify(m => m.RemoveItem(It.IsAny <string>(),
                                                                        It.IsAny <string>(),
                                                                        It.IsAny <string>(),
                                                                        It.IsAny <string>()), Times.Once, "not called");
            }
Beispiel #9
0
            public void CallWith2ListsInCollection_CallsCacheRepositoryRemoveItem10Times()
            {
                // arrange
                var             mockDependents = new MockDependents();
                ICacheListLogic testunit       = MakeTestsLogic(false, ref mockDependents);
                var             testContext    = new UserSelectedContext
                {
                    BranchId   = "FUT",
                    CustomerId = "234567"
                };
                var fakeUser  = new UserProfile();
                var testLists = new List <ListModel>
                {
                    new ListModel
                    {
                        BranchId       = "FUT",
                        CustomerNumber = "123456",
                        Type           = ListType.Contract,
                        ListId         = 5
                    },
                    new ListModel
                    {
                        BranchId       = "FUT",
                        CustomerNumber = "123456",
                        Type           = ListType.Favorite,
                        ListId         = 5
                    }
                };

                // act
                testunit.ClearCustomersListCaches(fakeUser, testContext.CustomerId, testContext.BranchId, testLists);

                // assert
                mockDependents.CacheRepository.Verify(m => m.RemoveItem(It.IsAny <string>(),
                                                                        It.IsAny <string>(),
                                                                        It.IsAny <string>(),
                                                                        It.IsAny <string>()), Times.Exactly(10), "not called");
            }
Beispiel #10
0
            public void AnyCall_CallsCacheRepositoryAddItem()
            {
                // arrange
                var             mockDependents = new MockDependents();
                ICacheListLogic testunit       = MakeTestsLogic(false, ref mockDependents);
                var             testContext    = new UserSelectedContext
                {
                    BranchId   = "FUT",
                    CustomerId = "234567"
                };
                var lists = new List <string>();

                // act
                testunit.AddCachedLabels(testContext, lists);

                // assert
                mockDependents.CacheRepository.Verify(m => m.AddItem(It.IsAny <string>(),
                                                                     It.IsAny <string>(),
                                                                     It.IsAny <string>(),
                                                                     It.IsAny <string>(),
                                                                     It.IsAny <TimeSpan>(),
                                                                     It.IsAny <List <string> >()), Times.Exactly(2), "not called");
            }