public async Task Delete_Success()
        {
            var items    = new GarmentShippingLocalReturnNoteItemModel();
            var repoMock = new Mock <IGarmentShippingLocalReturnNoteRepository>();

            repoMock.Setup(s => s.DeleteAsync(It.IsAny <int>()))
            .ReturnsAsync(1);

            var service = GetService(GetServiceProvider(repoMock.Object).Object);

            var result = await service.Delete(1);

            Assert.NotEqual(0, result);
        }
示例#2
0
        public void GetReportData_Success()
        {
            var items = new List <GarmentShippingLocalSalesNoteItemModel>
            {
                new GarmentShippingLocalSalesNoteItemModel(1, 1, "", "", 1, 1, "UOM1", 1, 1, 1, "")
                {
                    LocalSalesNoteId = 1
                },
                new GarmentShippingLocalSalesNoteItemModel(1, 1, "", "", 1, 2, "UOM2", 1, 1, 1, "")
                {
                    LocalSalesNoteId = 1
                },
                new GarmentShippingLocalSalesNoteItemModel(1, 1, "", "", 1, 1, "UOM1", 1, 1, 1, "")
                {
                    LocalSalesNoteId = 1
                },
            };

            var model = new GarmentShippingLocalSalesNoteModel("", 1, "", "", DateTimeOffset.Now, 1, "", "LBL TRANSAKSI", 1, "A999", "", "", "", 1, "", "", true, "", false, false, false, null, null, DateTimeOffset.Now, DateTimeOffset.Now, false, false, "", items)
            {
                Id = 1
            };

            var model2 = new GarmentShippingLocalReturnNoteItemModel(1, new GarmentShippingLocalSalesNoteItemModel(1, 1, "", "", 1, 1, "", 1, 1, 1, ""), 1)
            {
                Id = 1
            };

            var model3 = new GarmentShippingLocalPriceCuttingNoteItemModel(1, "", 1, 1, false)
            {
                Id = 1
            };

            var repoMock = new Mock <IGarmentShippingLocalSalesNoteRepository>();

            repoMock.Setup(s => s.ReadAll())
            .Returns(new List <GarmentShippingLocalSalesNoteModel>()
            {
                model
            }.AsQueryable());

            var repoMock1 = new Mock <IGarmentShippingLocalSalesNoteItemRepository>();

            repoMock1.Setup(s => s.ReadAll())
            .Returns(items.AsQueryable());

            var repoMock2 = new Mock <IGarmentShippingLocalReturnNoteRepository>();

            repoMock2.Setup(s => s.ReadItemAll())
            .Returns(new List <GarmentShippingLocalReturnNoteItemModel>()
            {
                model2
            }.AsQueryable());

            var repoMock3 = new Mock <IGarmentShippingLocalPriceCuttingNoteRepository>();

            repoMock3.Setup(s => s.ReadItemAll())
            .Returns(new List <GarmentShippingLocalPriceCuttingNoteItemModel>()
            {
                model3
            }.AsQueryable());

            var service = GetService(GetServiceProvider(repoMock.Object, repoMock1.Object, repoMock2.Object, repoMock3.Object).Object);

            var result = service.GetReportData(DateTime.MinValue, DateTime.Now, 0);

            Assert.NotEmpty(result.Item1);
        }