예제 #1
0
        public async Task ItShouldReturnTrueWhenNoWaringCheckFails()
        {
            await Task.Run(() =>
            {
                List <Disbsad> disbsads      = _mockData.GetDibsads();
                disbsads[0].SettlementPeriod = 30;
                disbsads[1].StorFlag         = "true";

                Item item = new Item()
                {
                    ItemPath     = "Inbound_Disbsad/SAA-I00G-Disbsad/2018/11/26/Disbsad.json",
                    ItemLocation = "location",
                    ItemId       = "DISBSAD"
                };

                ValidatedDisbsadCommand command = new ValidatedDisbsadCommand(item);
                _mockQuery.Setup(s => s.GetListAsync(command.Item.ItemPath, command.Item.ItemId)).Returns(Task.FromResult(disbsads));
                _mockWriter.Setup(s => s.UpLoadFile(disbsads, "")).Returns(Task.CompletedTask);
                ValidatedDisbsadCommandHandler commandHandler = new ValidatedDisbsadCommandHandler(_mockQuery.Object, _mockWriter.Object, _mockApplicationBuilder.Object);
                BusinessValidationProxy result = commandHandler.Handle(command, new CancellationToken()
                {
                }).Result;

                Assert.True(result.Valid);
            });
        }
예제 #2
0
 public async Task ItShouldReturnFalseWhenNoRecordFound()
 {
     await Task.Run(() =>
     {
         List <Disbsad> disbsads = new List <Disbsad>();
         Item item = new Item()
         {
             ItemPath     = "Inbound/path",
             ItemLocation = "location"
         };
         ValidatedDisbsadCommand command = new ValidatedDisbsadCommand(item);
         _mockQuery.Setup(s => s.GetListAsync(command.Item.ItemPath, command.Item.ItemLocation)).Returns(Task.FromResult(disbsads));
         _mockWriter.Setup(s => s.UpLoadFile(disbsads, "")).Returns(Task.CompletedTask);
         ValidatedDisbsadCommandHandler commandHandler = new ValidatedDisbsadCommandHandler(_mockQuery.Object, _mockWriter.Object, _mockApplicationBuilder.Object);
         BusinessValidationProxy result = commandHandler.Handle(command, new CancellationToken()
         {
         }).Result;
         Assert.False(result.InValid);
     });
 }