Пример #1
0
        public void Get_ReturnsList()
        {
            // Arrange
            var tagPostModel = new TagPostModel
            {
                Name  = Tag1Name,
                Color = Tag1Color
            };
            var id = PostAndMarkForDelete(tagPostModel);

            // Act
            var data = TagClient.List().Get().AssertResult();

            // Assert
            Assert.Greater(data.TotalItems, 0);
            Assert.Greater(data.TotalPages, 0);
            Assert.NotNull(data.Items);
            Assert.NotZero(data.Items.Count());
            var tag = data.Items.First(t => t.Id == id);

            Assert.AreEqual(id, tag.Id);
            Assert.AreEqual(tagPostModel.Color, tag.Color);
            Assert.AreEqual(tagPostModel.Name, tag.Name);
        }
Пример #2
0
        public async Task UpdateTagAsync_FullUpdate_SuccessfullyUpdated()
        {
            // Arrange
            var tagPostModel = new TagPostModel
            {
                Name  = Tag1Name,
                Color = Tag1Color
            };
            var id            = PostAndMarkForDelete(tagPostModel);
            var tagPatchModel = new TagPatchModel
            {
                Id    = id,
                Name  = Tag2Name,
                Color = Tag2Color
            };

            // Act
            var tagGetModel = (await TagClient.UpdateAsync(tagPatchModel)).AssertResult();

            // Assert
            Assert.NotZero(tagGetModel.Id);
            Assert.AreEqual(Lowercase(tagPatchModel.Color), tagGetModel.Color);
            Assert.AreEqual(tagPatchModel.Name, tagGetModel.Name);
        }
Пример #3
0
 /// <inheritdoc />
 public ApiResult <TagGetModel> Post(TagPostModel model)
 {
     return(Post <TagPostModel, TagGetModel>(model));
 }
Пример #4
0
 /// <inheritdoc />
 public Task <ApiResult <TagGetModel> > PostAsync(TagPostModel model, CancellationToken cancellationToken = default)
 {
     return(PostAsync <TagPostModel, TagGetModel>(model, cancellationToken));
 }