Ejemplo n.º 1
0
        public void ReturnsNullIfNoProviders()
        {
            var testSubject = new ProviderMatcher();

            var result = testSubject.Match(_packageLocator);

            Assert.That(result, Is.Null);
        }
Ejemplo n.º 2
0
        public void GetMatchingProvider_TrelloManager_IsSelected_WhenTrelloExactMatch()
        {
            var args = new[] { "Eat", "my", "kittens", "-tm", "-trello", "-p" };
            List <ITaskManager> taskManagers        = SetupTaskManagerListWithOutlookDefaultAndTrelloTaskManagers();
            ITaskManager        selectedTaskManager = ProviderMatcher.GetMatchingTaskManager(args, taskManagers);

            Assert.Equal("Trello Task Manager", selectedTaskManager.FriendlyName);
        }
Ejemplo n.º 3
0
        public void ReturnsNullIfNoProviders()
        {
            var testSubject = new ProviderMatcher();

             var result = testSubject.Match(_packageLocator);

             Assert.That(result, Is.Null);
        }
Ejemplo n.º 4
0
        public void ThrowExceptionIfMultipleProvidersMatch()
        {
            A.CallTo(() => _providerA.IsMatch(_packageLocator)).Returns(true);
            A.CallTo(() => _providerB.IsMatch(_packageLocator)).Returns(true);

            var testSubject = new ProviderMatcher(_providerA, _providerB);

            Assert.That(() => testSubject.Match(_packageLocator), Throws.InstanceOf <AmbiguousPackageLocatorException>());
        }
Ejemplo n.º 5
0
        public void ReturnsNullIfNoMatch()
        {
            A.CallTo(() => _providerA.IsMatch(_packageLocator)).Returns(false);
             A.CallTo(() => _providerB.IsMatch(_packageLocator)).Returns(false);

             var testSubject = new ProviderMatcher(_providerA, _providerB);

             var result = testSubject.Match(_packageLocator);

             Assert.That(result, Is.Null);
        }
Ejemplo n.º 6
0
        public void MatchesSecondProvider()
        {
            A.CallTo(() => _providerA.IsMatch(_packageLocator)).Returns(false);
             A.CallTo(() => _providerB.IsMatch(_packageLocator)).Returns(true);

             var testSubject = new ProviderMatcher(_providerA, _providerB);

             var result = testSubject.Match(_packageLocator);

             Assert.That(result, Is.SameAs(_providerB));
        }
Ejemplo n.º 7
0
        public void ReturnsNullIfNoMatch()
        {
            A.CallTo(() => _providerA.IsMatch(_packageLocator)).Returns(false);
            A.CallTo(() => _providerB.IsMatch(_packageLocator)).Returns(false);

            var testSubject = new ProviderMatcher(_providerA, _providerB);

            var result = testSubject.Match(_packageLocator);

            Assert.That(result, Is.Null);
        }
Ejemplo n.º 8
0
        public void MatchesSecondProvider()
        {
            A.CallTo(() => _providerA.IsMatch(_packageLocator)).Returns(false);
            A.CallTo(() => _providerB.IsMatch(_packageLocator)).Returns(true);

            var testSubject = new ProviderMatcher(_providerA, _providerB);

            var result = testSubject.Match(_packageLocator);

            Assert.That(result, Is.SameAs(_providerB));
        }
Ejemplo n.º 9
0
        // GET: MatchMakingTest
        public ActionResult Index(int?id)
        {
            if (id > 0)
            {
                GeneralUser initiator = db.Users.Where(st => st.Id == id).OfType <StudentUser>().FirstOrDefault();

                List <GeneralUser> listaFabrika = db.Users.OfType <ProviderUser>().Cast <GeneralUser>().ToList();

                ProviderMatcher    matcher    = new ProviderMatcher(initiator);
                List <GeneralUser> sortedList = matcher.GetMatchingProvider(listaFabrika);

                return(View(sortedList.ToList()));
            }
            return(HttpNotFound());
        }
Ejemplo n.º 10
0
        GetMatchingProvider_DefaultManager_IsSelected_WhenThereIsMultipleTaskManagers_ButTheOthersHaveHigherOrderValues()
        {
            var args = new[] { "Eat", "my", "kittens", "-tm", "-h", "-p" };

            List <ITaskManager> taskManagers = SetupTaskManagerListWithOutlookDefaultAndTrelloTaskManagers();

            var fakeTM = new Mock <ITaskManager>();

            fakeTM.SetupGet(tm => tm.CommandLineSwitch).Returns("*");
            fakeTM.SetupGet(tm => tm.Order).Returns(101);
            fakeTM.SetupGet(tm => tm.FriendlyName).Returns("Fake Task Manager");

            taskManagers.Add(fakeTM.Object);

            ITaskManager selectedTaskManager = ProviderMatcher.GetMatchingTaskManager(args, taskManagers);

            Assert.Equal("Outlook Task Manager", selectedTaskManager.FriendlyName);
        }
Ejemplo n.º 11
0
        private static void Main(string[] args)
        {
            ContainerBootstrapper.BootstrapStructureMap(args);

            IContainer           container    = ObjectFactory.Container;
            IList <ITaskManager> taskManagers = container.GetAllInstances <ITaskManager>();

            if (ShouldUsageBeShown(args))
            {
                ShowUsage(taskManagers);
                return;
            }

            var argumentParser = ObjectFactory.GetInstance <IArgumentParser>();
            var optionParser   = ObjectFactory.GetInstance <IOptionsParser>();

            ITaskBuilder taskBuilder = new TaskBuilder(args, argumentParser, optionParser);
            ITaskDTO     taskDto     = taskBuilder.CreateTask();
            bool         taskCreated = false;

            ITaskManager taskManagerToRun = ProviderMatcher.GetMatchingTaskManager(args, taskManagers);

            taskManagerToRun.CreateTask(taskDto);
        }
Ejemplo n.º 12
0
        public void ThrowExceptionIfMultipleProvidersMatch()
        {
            A.CallTo(() => _providerA.IsMatch(_packageLocator)).Returns(true);
             A.CallTo(() => _providerB.IsMatch(_packageLocator)).Returns(true);

             var testSubject = new ProviderMatcher(_providerA, _providerB);

             Assert.That(() => testSubject.Match(_packageLocator), Throws.InstanceOf<AmbiguousPackageLocatorException>());
        }