示例#1
0
        public void Should_Create_A_Todo_WithoutDefaultId()
        {
            var todoStub = TodoModelStub.GetSimpleTodo();

            _repositoryMock.Setup(p => p.Add(todoStub)).Returns(todoStub);

            var todoService = new TodoService(_repositoryMock.Object);

            var(validation, result) = todoService.Create(todoStub);

            Assert.AreEqual(null, validation);
        }
示例#2
0
        public void Should_Refuse_To_Create_A_Todo_InvalidDate()
        {
            var todoStub = TodoModelStub.GetSimpleTodo();

            todoStub.Expires = todoStub.Expires.AddDays(-2);

            _repositoryMock.Setup(p => p.Add(todoStub)).Returns(todoStub);

            var todoService = new TodoService(_repositoryMock.Object);

            var(validation, result) = todoService.Create(todoStub);

            Assert.IsFalse(validation == null);
            Assert.IsTrue(validation.Errors.Count > 0);
        }