示例#1
0
        public async Task GivenCreateBulkAsyncWhenInputIsValidThenCreatesData()
        {
            // Arrange
            mockVideoService
            .Setup(_ => _.CreateBulkAsync(It.IsAny <ICollection <Video> >()))
            .Returns(Task.CompletedTask)
            .Verifiable();

            // Act
            var result = await videoController.CreateBulkAsync(It.IsAny <ICollection <Video> >());

            // Assert
            mockVideoService.VerifyAll();
            result.Should().NotBeNull().And.BeOfType <CreatedResult>();
            (result as CreatedResult).StatusCode.Should().Be((int)HttpStatusCode.Created);
        }
        public async Task GivenCreateBulkAsyncWhenInputIsValidThenCreatesData()
        {
            // Arrange
            mockVideoService
            .Setup(_ => _.CreateBulkAsync(It.IsAny <ICollection <Video> >()))
            .Returns(Task.CompletedTask)
            .Verifiable();

            // Act
            var result = await videoController.CreateBulkAsync(It.IsAny <ICollection <Video> >());

            // Assert
            mockVideoService.VerifyAll();
            Assert.That(result, Is.InstanceOf <CreatedResult>());
            Assert.That((result as CreatedResult).StatusCode, Is.EqualTo((int)HttpStatusCode.Created));
        }