コード例 #1
0
        public async void ReturnArgumentOutOfRangeException_IfNoObject()
        {
            var command = new CreateActivityCommand(null);
            var handler = new CreateActivityHandler(_unitOfWork.Object);

            Assert.ThrowsAsync <ArgumentOutOfRangeException>(() => handler.Handle(command, new CancellationToken()));
        }
コード例 #2
0
        public async void ReturnNotNullActivity()
        {
            var tempActivity = new Activity()
            {
                ActivityName = "test", Id = 1
            };
            var tempActivityModel = new ActivityModel()
            {
                ActivityName = "test",
                ActivityId   = 1
            };

            _unitOfWork.Setup(mock => mock.ActivityRepository.Create(It.IsAny <Activity>()))
            .Returns(tempActivity);

            var command     = new CreateActivityCommand(tempActivityModel);
            var handler     = new CreateActivityHandler(_unitOfWork.Object);
            var returnValue = await handler.Handle(command, new CancellationToken());

            Assert.NotNull(returnValue);
        }