Beispiel #1
0
        public async Task DeactivateVendor_ReturnsTrue()
        {
            // arrange
            var vendor = new Vendor {
                id = 123
            };

            _vendorsQueryMock.Setup(x => x.GetByUserName(It.IsAny <string>()))
            .Returns(Task.Factory.StartNew(() => vendor));

            _vendorsQueryMock.Setup(x => x.Deactivate(It.IsAny <string>()))
            .Returns(Task.Factory.StartNew(() => true));

            // act
            var task = await _sut.Deactivate("aUser");

            // assert
            Assert.IsType <OkObjectResult>(task);

            var result      = task as OkObjectResult;
            var usersResult = result.Value as bool?;

            Assert.True(usersResult);
        }