예제 #1
0
        public void WhenPassingAnInvalidIdShouldThrowAnException(string id)
        {
            var removeUseCase = new Remove(_dataGateway);

            Assert.Throws <BusinessException>(() =>
            {
                removeUseCase.Execute(id);
            });
        }
예제 #2
0
        public void Remove(string key)
        {
            Check.IsNullOrWhiteSpace <ArgumentNullException>(key);

            using (var command = new Remove(host: _host, port: _port))
            {
                command.Execute(key);
            }
        }
예제 #3
0
        public void RemoveChangesContext()
        {
            InMemoryContext inMemory = new InMemoryContext();
            IItemGateway    gateway  = new InMemoryItemGateway(inMemory);
            IUseCase        sut      = new Remove(gateway);

            sut.Execute(existingTodoItemId);

            Assert.Empty(inMemory.Items.Where(e => e.Id == new Guid(existingTodoItemId)));
        }
예제 #4
0
        public void ShouldRemoveAnItem()
        {
            var removeUseCase = new Remove(_dataGateway);

            removeUseCase.Execute(_itemCreatedId);

            var item = _dataContext.Items.FirstOrDefault(x => x.Id.ToString() == _itemCreatedId);

            Assert.Null(item);
        }
예제 #5
0
        public void GivenAccountId_RemoveAccount()
        {
            var context = new InMemoryContext();
            var gateway = new InMemoryAccountGateway(context);
            var sut     = new Remove(gateway);
            var request = new Request(existingAccountId);

            sut.Execute(request);

            Assert.Empty(context.Accounts.Where(e => e.Id == new Guid(existingAccountId)));
        }
예제 #6
0
        public void Execute_OfRemove_RemovesSpecifiedLines()
        {
            var rte = MakeRunTimeEnvironment();

            rte.AddOrUpdate(new Line("10", new Nop()));
            rte.AddOrUpdate(new Line("20", new Nop()));
            rte.AddOrUpdate(new Line("30", new Nop()));
            var remove = new Remove(new Range(20));

            remove.Execute(rte);
            var actual = rte.Lines.Select(line => line.Label).ToList();

            CollectionAssert.AreEqual(new[] { "10", "30" }, actual);
        }
예제 #7
0
        public UnknownParameterEditor()
        {
            InitializeComponent();

            const int BUTTON_SIZE = 16;

            m_textBox = new MyTextBox(drawWindow1, () => new RectangleF(0, 0, drawWindow1.Width - BUTTON_SIZE, Math.Max(BUTTON_SIZE, drawWindow1.Height)), MyTextBox.InputFormEnum.None, null, x => MyTextBox.TextBoxBorderDaniel, 4, Fonts.Default);
            m_textBox.RequestedAreaChanged += () =>
            {
                //Draw window is the whole control so we can just modify the control
                MinimumSize = new Size(BUTTON_SIZE, (int)m_textBox.RequestedArea.Height);
                Size size = m_textBox.RequestedArea.ToSize();
                size.Width += BUTTON_SIZE;
                Size        = size;
            };
            m_textBox.RegisterCallbacks(this, drawWindow1);
            //MyTextBox.SetupCallbacks(drawWindow1, m_textBox);

            m_button = new CrossButton(() => new RectangleF(drawWindow1.Width - BUTTON_SIZE, (drawWindow1.Height - BUTTON_SIZE) / 2, BUTTON_SIZE, BUTTON_SIZE), () => { Remove.Execute(); m_remove = true; }, Pens.Magenta, Brushes.Magenta);
            m_button.RegisterCallbacks(this, drawWindow1);

            LastFocused = m_textBox;
        }