示例#1
0
        public async Task When_ValueByIdIsCalled_Expect_ValueWithIdCalled()
        {
            // Arrange
            var expectValue = new Value {
                Id           = new Guid(),
                DateCreated  = new DateTime(),
                DateModified = new DateTime(),
                Title        = "Title",
                Message      = "Message"
            };

            // Expectations
            _valueRepositoryMock.Setup(x => x.Create(It.IsAny <Value> ())).Returns(Task.FromResult(expectValue));

            // Act
            var result = await _sut.AddValueAsync(expectValue);

            // Assert
            Assert.Equal(result.Id, expectValue.Id);
            Assert.NotNull(result.DateCreated);
            Assert.NotNull(result.DateModified);
            Assert.Equal(result.Title, expectValue.Title);
            Assert.Equal(result.Message, expectValue.Message);
        }