コード例 #1
0
        public async void ShouldRestoreRecipeCorrectly()
        {
            var mediatorMock = new Mock <IMediator>();
            var controller   = new AdminRecipeController(mediatorMock.Object);

            await controller.RestoreRecipe(new Guid("F3583BB5-DCD4-4161-990F-CF97D7156B97"));

            mediatorMock.Verify(x => x.Send(It.Is <RestoreRecipe>(y => y.EntityId == new Guid("F3583BB5-DCD4-4161-990F-CF97D7156B97")), It.IsAny <CancellationToken>()), Times.Once);
            mediatorMock.VerifyNoOtherCalls();
        }
コード例 #2
0
        public async void ShouldGetByIdCorrectly()
        {
            var mediatorMock = new Mock <IMediator>();
            var controller   = new AdminRecipeController(mediatorMock.Object);

            await controller.GetById(new Guid("F3583BB5-DCD4-4161-990F-CF97D7156B97"));

            mediatorMock.Verify(x => x.Send(It.Is <GetRecipeById>(y => y.Id == new Guid("F3583BB5-DCD4-4161-990F-CF97D7156B97") && y.StripMetadata == false), It.IsAny <CancellationToken>()), Times.Once);
            mediatorMock.VerifyNoOtherCalls();
        }