コード例 #1
0
        public void GivenNullTitle_ThrowsException()
        {
            var request     = new Core.Boundaries.AddTodoItem.Request(null);
            var addTodoItem = new AddTodoItem(null, null, null);

            Assert.Throws <Exception>(() => addTodoItem.Execute(request));
        }
コード例 #2
0
        public void GivenEmptyTitle_ThrowsException()
        {
            var request     = new Request(string.Empty);
            var addTodoItem = new AddTodoItem(null, null, null);

            Assert.Throws <Exception>(() => addTodoItem.Execute(request));
        }
コード例 #3
0
        public void GivenNotNullTitle_ReturnsId()
        {
            var context         = new InMemoryContext();
            var gateway         = new TodoItemGateway(context);
            var responseHandler = new ResponseHandler();
            var entitiesFactory = new EntitiesFactory();

            var request     = new Request("My Title");
            var addTodoItem = new AddTodoItem(responseHandler, gateway, entitiesFactory);

            addTodoItem.Execute(request);
            Assert.True(Guid.Empty != responseHandler.AddTodoItems[0].Id);
        }
コード例 #4
0
        public void GivenNotNullTitle_InvokeOutputHandler()
        {
            var context         = new InMemoryContext();
            var gateway         = new TodoItemGateway(context);
            var responseHandler = new ResponseHandler();
            var entitiesFactory = new EntitiesFactory();

            var request     = new Request("My Title");
            var addTodoItem = new AddTodoItem(responseHandler, gateway, entitiesFactory);

            addTodoItem.Execute(request);
            Assert.Single(responseHandler.AddTodoItems);
        }
コード例 #5
0
        public void GivenNullInput_ThrowsException()
        {
            var addTodoItem = new AddTodoItem(null, null, null);

            Assert.Throws <Exception>(() => addTodoItem.Execute(null));
        }