Exemple #1
0
        private Test CreateTest(dynamic test, string domain, string testCollectionName)
        {
            var commands = new List <ICommand>();

            foreach (var command in test.Commands)
            {
                commands.Add(_commandService.CreateCommand(command));
            }

            var url = test.Url.ToString();

            var baseUri = domain.EndsWith("/")
                ? new Uri(domain)
                : new Uri(domain + "/");

            var relativeUri = new Uri(baseUri, url);

            return(new Test
            {
                CollectionName = testCollectionName,
                Commands = commands,
                Enabled = test.Enabled ?? true,
                Name = test.Name,
                Url = url,
                TestUrl = relativeUri.ToString()
            });
        }
 public NewCommandResponse Create(NewCommandRequest request)
 {
     return(_commandService.CreateCommand(request));
 }
Exemple #3
0
        public void ToolBarSiteNamesShouldYieldAllSiteNames()
        {
            Assert.IsFalse(_toolBarService.ToolBarSiteNames.GetEnumerator().MoveNext());
            const string site1Name   = "site1";
            const string site2Name   = "site2";
            var          cabCommand1 = new Command();
            var          cabCommand2 = new Command();
            var          command1    = _commandService.CreateCommand(cabCommand1, "command1", null);
            var          command2    = _commandService.CreateCommand(cabCommand2, "command2", null);

            _toolBarService.AddButtonItem(site1Name, command1, null, null);
            _toolBarService.AddButtonItem(site1Name, command2, null, null);
            var item       = _toolBarService.AddButtonItem(site2Name, command1, null, null);
            var enumerator = _toolBarService.ToolBarSiteNames.GetEnumerator();

            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("site1", enumerator.Current);
            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("site2", enumerator.Current);
            Assert.IsFalse(enumerator.MoveNext());

            _toolBarService.Remove(item);
            enumerator = _toolBarService.ToolBarSiteNames.GetEnumerator();
            Assert.IsTrue(enumerator.MoveNext());
            Assert.AreEqual("site1", enumerator.Current);
            Assert.IsFalse(enumerator.MoveNext());
        }
 private CommandReadDto GetCommandReadDtoFromDbResponse(Command command)
 {
     return(_mapper.Map <CommandReadDto>(_commandService.CreateCommand(command)));
 }