Beispiel #1
0
        internal async Task GivenCreateBulkAsyncWhenInputIsValidThenCreatesData()
        {
            // Arrange
            mockSubscriptionService
            .Setup(_ => _.CreateBulkAsync(It.IsAny <ICollection <Subscription> >()))
            .Returns(Task.CompletedTask)
            .Verifiable();

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

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

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

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