示例#1
0
        public async void Handle_WhenPayLoadIsFound_ShouldReturnTrue(AnalyzeDiffCommand command, byte[] leftContent, byte[] rightContent,
                                                                     NotOfEqualSizeDiff diff)
        {
            var payLoads = new List <PayLoad>
            {
                new PayLoad(command.CorrelationId, leftContent, SideEnum.Left),
                new PayLoad(command.CorrelationId, rightContent, SideEnum.Right)
            };

            _payLoadRepository.GetByCorrelationId(command.CorrelationId).Returns(payLoads);
            _diffEngine.ProcessDiff(command.CorrelationId, leftContent, rightContent).Returns(diff);

            var result = await _sut.Handle(command, new CancellationToken());

            result.Should().BeTrue();
        }
示例#2
0
        public async void Handle_WhenPayLoadIsFound_ShouldProcessDiffAndSaveItInTheCache(AnalyzeDiffCommand command, byte[] leftContent, byte[] rightContent,
                                                                                         NotOfEqualSizeDiff diff)
        {
            var payLoads = new List <PayLoad>
            {
                new PayLoad(command.CorrelationId, leftContent, SideEnum.Left),
                new PayLoad(command.CorrelationId, rightContent, SideEnum.Right)
            };

            _payLoadRepository.GetByCorrelationId(command.CorrelationId).Returns(payLoads);
            _diffEngine.ProcessDiff(command.CorrelationId, leftContent, rightContent).Returns(diff);
            _ = await _sut.Handle(command, new CancellationToken());

            await _cache.Received(1).SetAsync($"diff_{command.CorrelationId}", diff, 86400);
        }
示例#3
0
        public void Map_WhenMappingFromNotOfEqualSizeDiffToDiffResponse_ShouldMapAsExpected(IMapper sut, NotOfEqualSizeDiff notOfEqualSizeDiff)
        {
            Diff diff = notOfEqualSizeDiff;

            var result = sut.Map <DiffResponse>(diff);

            result.Should().BeOfType <NotOfEqualSizeResponse>();
        }