示例#1
0
        public async Task PutAsync_Test()
        {
            //Arrange
            var group    = Fixture.Create <Models.Group>();
            var document = new Group {
                Id = _id, ApplicationId = ApplicationId, Name = group.Name
            };

            Container.ReadItemAsync <Group>(Arg.Is(_id), Arg.Any <PartitionKey>())
            .Returns(CreateItemResponse(HttpStatusCode.OK, document));

            //Act
            var result = await _sut.PutAsync(ApplicationId, _id, group).ConfigureAwait(false);

            //Assert
            result.Should().NotBeNull();
            result.Should().BeOfType <OkObjectResult>();
            var ok = result as OkObjectResult;

            ok.Should().NotBeNull();
            var groupResult = ok.Value as Models.Group;

            groupResult.Should().NotBeNull();

            await Container.Received(1)
            .ReadItemAsync <Group>(Arg.Is(_id), Arg.Any <PartitionKey>())
            .ConfigureAwait(false);
        }