示例#1
0
        public void AddingItemsToTheList(IListFactory listFactory)
        {
            /* Translated from:
             *    list = List.new
             *    assert_nil(list.find("fred"))
             *    list.add("fred")
             *    assert_equal("fred", list.find("fred").value())
             *    assert_nil(list.find("wilma"))
             *    list.add("wilma")
             *    assert_equal("fred",  list.find("fred").value())
             *    assert_equal("wilma", list.find("wilma").value())
             *    assert_equal(["fred", "wilma"], list.values())
             *
             * It would be cleaner to write separate Arrange-Act-Assert tests for each part of this!*/

            var list = listFactory.Create();

            Assert.IsNull(list.Find("fred"));
            list.Add("fred");
            Assert.AreEqual("fred", list.Find("fred").Value);
            Assert.IsNull(list.Find("wilma"));
            list.Add("wilma");
            Assert.AreEqual("fred", list.Find("fred").Value);
            Assert.AreEqual("wilma", list.Find("wilma").Value);
            CollectionAssert.AreEqual(new[] { "fred", "wilma" }, list.Values);
        }
 public ToDoListsService(IToDoListDomainRepository toDoListRepository, IListFactory toDoListFactory, IUserRepository userRepository, IBusPublisher publisher)
 {
     _toDoListRepository = toDoListRepository ?? throw new ArgumentNullException(nameof(toDoListRepository));
     _toDoListFactory    = toDoListFactory ?? throw new ArgumentNullException(nameof(toDoListFactory));
     _userRepository     = userRepository ?? throw new ArgumentNullException(nameof(userRepository));
     _publisher          = publisher ?? throw new ArgumentNullException(nameof(publisher));
 }
示例#3
0
 public SubCategoryEdits(IServiceHandlerFactory ServiceHandlerFactory
                         , IFilterFactory FilterFactory
                         , IListFactory ListFactory
                         , ICommonInfo CommonInfo
                         )
     : base(ServiceHandlerFactory, FilterFactory, ListFactory, CommonInfo)
 {
 }
示例#4
0
 public CoverageLimitsController(IListFactory listFactory, ILogger <CoverageLimitsController> logger, CoverageBalanceHandler coverageHandler, IHttpContextAccessor httpContextAccessor, GetLang _getLang)
 {
     _listFactory         = listFactory;
     _logger              = logger;
     _coverageHandler     = coverageHandler;
     _httpContextAccessor = httpContextAccessor;
     getLang              = _getLang;
     langcode             = getLang.GetLanguage();
 }
 public ProvidersController(IListFactory listFactory, ILogger <ProvidersController> logger, ProvidersHandler providersHandler, IHttpContextAccessor httpContextAccessor, GetLang _getLang)
 {
     _logger              = logger;
     this._listFactory    = listFactory;
     _providersHandler    = providersHandler;
     _httpContextAccessor = httpContextAccessor;
     getLang              = _getLang;
     langcode             = getLang.GetLanguage();
 }
 public PolicyController(ILogger <PolicyController> logger,
                         PolicyHandler policyHandler, IHttpContextAccessor httpContextAccessor, IListFactory listFactory, GetLang _getLang)
 {
     _logger              = logger;
     _policyHandler       = policyHandler;
     _httpContextAccessor = httpContextAccessor;
     getLang              = _getLang;
     this._listFactory    = listFactory;
     langcode             = getLang.GetLanguage();
 }
示例#7
0
        public void EnsurePassedListIsUsed()
        {
            factoryMock = new Mock<IFactory<int>>();
            var listMock = new Mock<IList<int>>();

            listFactory = new ListFactory<int>(listMock.Object, factoryMock.Object);
            //int result = 1;
            //factoryMock.Setup(c => c.Generate()).Returns(result);
            var result = listFactory.Generate();
            Assert.Same(result, listMock.Object);
        }
 public ApprovalsController(IListFactory listFactory, IAuthService authenticationService, ILogger <ApprovalsController> logger,
                            IOptions <ApplConfig> _config, ApprovalsHandler approvalsHandler, IHttpContextAccessor httpContextAccessor, GetLang _getLang)
 {
     this._authenticationService = authenticationService;
     this._listFactory           = listFactory;
     _logger              = logger;
     appSettings          = _config;
     _approvalsHandler    = approvalsHandler;
     _httpContextAccessor = httpContextAccessor;
     getLang              = _getLang;
     langcode             = getLang.GetLanguage();
 }
示例#9
0
 public void EnsurePassedFactoryIsUsed(int value1, int value2, int value3)
 {
     int[] values = new[] { value1, value2, value3 };
     factoryMock = new Mock<IFactory<int>>();
     listFactory = new ListFactory<int>(factoryMock.Object);
     int counter = 0;
     factoryMock.Setup(f => f.Generate()).Returns(()=>this.GetArrayValue(ref counter, values));
     var result = listFactory.Generate(3);
     for (int i = 0; i < result.Count; i++)
     {
         Assert.Equal(values[i],result[i]);
     }
 }
示例#10
0
 public ClaimsController(IAuthService authService, ICustomerService customerService, IListFactory listFactory, ILogger <ClaimsController> logger, IHttpContextAccessor httpContextAccessor, GetLang _getLang,
                         ClaimsHandler claimsHandler, CustomerHandler customerHandler)
 {
     _authenticationService = authService;
     this._listFactory      = listFactory;
     this._customerService  = customerService;
     _logger = logger;
     _httpContextAccessor = httpContextAccessor;
     getLang         = _getLang;
     langcode        = getLang.GetLanguage();
     _claimsHandler  = claimsHandler;
     CustomerHandler = customerHandler;
 }
示例#11
0
 public WordDocumentRepository(
     IWordKiller wordKiller,
     IExternalHyperLinkFactory externalHyperLinkFactory,
     IWordFactory wordFactory,
     ITableFactory tableFactory,
     IShapeFactory shapeFactory,
     IListFactory listFactory,
     ISectionsFactory sectionsFactory)
 {
     _wordKiller = wordKiller;
     _externalHyperLinkFactory = externalHyperLinkFactory;
     _wordFactory     = wordFactory;
     _tableFactory    = tableFactory;
     _listFactory     = listFactory;
     _sectionsFactory = sectionsFactory;
     _shapeFactory    = shapeFactory;
 }
示例#12
0
        public void Show(IListFactory listFactory)
        {
            //поиск длинны самого длинного списка на данный момент
            var max = listFactory.MaxCount;

            var todoListNames = listFactory.GetNames();

            Console.WriteLine(string.Join(" | ", todoListNames));
            for (var i = 0; i < max; i++)
            {
                foreach (var name in todoListNames)
                {
                    var goals = listFactory
                                .GetList(name)
                                .Goals;
                    ShowGoal(goals, i);
                }
                Console.WriteLine();
            }
        }
示例#13
0
        public void DeletingItemsFromTheList(IListFactory listFactory)
        {
            /* Translated from:
             *    list = List.new
             *    list.add("fred")
             *    list.add("wilma")
             *    list.add("betty")
             *    list.add("barney")
             *    assert_equal(["fred", "wilma", "betty", "barney"], list.values())
             *    list.delete(list.find("wilma"))
             *    assert_equal(["fred", "betty", "barney"], list.values())
             *    list.delete(list.find("barney"))
             *    assert_equal(["fred", "betty"], list.values())
             *    list.delete(list.find("fred"))
             *    assert_equal(["betty"], list.values())
             *    list.delete(list.find("betty"))
             *    assert_equal([], list.values())
             *
             * It would be cleaner to write separate Arrange-Act-Assert tests for each part of this!*/

            var list = listFactory.Create();

            list.Add("fred");
            list.Add("wilma");
            list.Add("betty");
            list.Add("barney");
            CollectionAssert.AreEqual(new[] { "fred", "wilma", "betty", "barney" }, list.Values);
            list.Delete(list.Find("wilma"));
            CollectionAssert.AreEqual(new[] { "fred", "betty", "barney" }, list.Values);
            list.Delete(list.Find("barney"));
            CollectionAssert.AreEqual(new[] { "fred", "betty" }, list.Values);
            list.Delete(list.Find("fred"));
            CollectionAssert.AreEqual(new[] { "betty" }, list.Values);
            list.Delete(list.Find("betty"));
            CollectionAssert.AreEqual(new string[0], list.Values);
        }
示例#14
0
 public TodoListsProxy()
 {
     _todoListFactory = new TodoListsFactory();
     _todoLists       = new Dictionary <string, ITodoList>();
 }
示例#15
0
 public VisitorsController(ICommandAgent commandAgent, IListFactory <Visitor> visitorListFactory)
 {
     this.commandAgent       = commandAgent;
     this.visitorListFactory = visitorListFactory;
 }
 public CollectionFacade(IListFactory listFactory, ITreeFactory treeFactory)
 {
     this.ListFactory = listFactory ?? throw new ArgumentNullException(nameof(listFactory));
     this.TreeFactory = treeFactory ?? throw new ArgumentNullException(nameof(treeFactory));
 }
 public VisitorsController(ICommandAgent commandAgent, IListFactory<Visitor> visitorListFactory)
 {
     this.commandAgent = commandAgent;
     this.visitorListFactory = visitorListFactory;
 }