public async Task Get_StateUnderTest_ExpectedBehavior() { // Arrange var unitUnderTest = CreateGarmentSewingOutController(); _mockGarmentSewingOutRepository .Setup(s => s.Read(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(new List <GarmentSewingOutReadModel>().AsQueryable()); Guid sewingOutGuid = Guid.NewGuid(); _mockGarmentSewingOutRepository .Setup(s => s.Find(It.IsAny <IQueryable <GarmentSewingOutReadModel> >())) .Returns(new List <GarmentSewingOut>() { new GarmentSewingOut(sewingOutGuid, null, new BuyerId(1), null, null, new UnitDepartmentId(1), null, null, "Finishing", DateTimeOffset.Now, "RONo", null, new UnitDepartmentId(1), null, null, new GarmentComodityId(1), null, null, true) }); Guid sewingInItemGuid = Guid.NewGuid(); Guid sewingInGuid = Guid.NewGuid(); Guid sewingOutItemGuid = Guid.NewGuid(); GarmentSewingOutItem garmentSewingOutItem = new GarmentSewingOutItem(sewingOutItemGuid, sewingOutGuid, sewingInGuid, sewingInItemGuid, new ProductId(1), null, null, null, new SizeId(1), null, 1, new UomId(1), null, null, 1, 1, 1); _mockGarmentSewingOutItemRepository .Setup(s => s.Query) .Returns(new List <GarmentSewingOutItemReadModel>() { garmentSewingOutItem.GetReadModel() }.AsQueryable()); GarmentSewingOutDetail garmentSewingOutDetail = new GarmentSewingOutDetail(Guid.NewGuid(), sewingOutItemGuid, new SizeId(1), null, 1, new UomId(1), null); _mockGarmentSewingOutDetailRepository .Setup(s => s.Query) .Returns(new List <GarmentSewingOutDetailReadModel>() { garmentSewingOutDetail.GetReadModel() }.AsQueryable()); // Act var result = await unitUnderTest.Get(); // Assert Assert.Equal((int)HttpStatusCode.OK, GetStatusCode(result)); }
public async Task GetComplete_Return_Success() { var unitUnderTest = CreateGarmentSewingOutController(); Guid id = Guid.NewGuid(); _mockGarmentSewingOutRepository .Setup(s => s.Read(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())) .Returns(new List <GarmentSewingOutReadModel>().AsQueryable()); _mockGarmentSewingOutRepository .Setup(s => s.Find(It.IsAny <IQueryable <GarmentSewingOutReadModel> >())) .Returns(new List <GarmentSewingOut>() { new GarmentSewingOut(id, null, new BuyerId(1), null, null, new UnitDepartmentId(1), null, null, "Finishing", DateTimeOffset.Now, "RONo", null, new UnitDepartmentId(1), null, null, new GarmentComodityId(1), null, null, true) }); GarmentSewingOutItem garmentSewingOutItem = new GarmentSewingOutItem(id, id, id, id, new ProductId(1), null, null, null, new SizeId(1), null, 1, new UomId(1), null, null, 1, 1, 1); _mockGarmentSewingOutItemRepository .Setup(s => s.Query) .Returns(new List <GarmentSewingOutItemReadModel>() { garmentSewingOutItem.GetReadModel() }.AsQueryable()); _mockGarmentSewingOutItemRepository .Setup(s => s.Find(It.IsAny <IQueryable <GarmentSewingOutItemReadModel> >())) .Returns(new List <GarmentSewingOutItem>() { new GarmentSewingOutItem(id, id, id, id, new ProductId(1), "productCode", "productName", "designColor", new SizeId(1), "sizeName", 1, new UomId(1), "uomUnit", "color", 1, 1, 1) }); GarmentSewingOutDetail garmentSewingOutDetail = new GarmentSewingOutDetail(id, id, new SizeId(1), "sizeName", 1, new UomId(1), "uomUnit"); _mockGarmentSewingOutDetailRepository .Setup(s => s.Query) .Returns(new List <GarmentSewingOutDetailReadModel>() { garmentSewingOutDetail.GetReadModel() }.AsQueryable()); _mockGarmentSewingOutDetailRepository .Setup(s => s.Find(It.IsAny <IQueryable <GarmentSewingOutDetailReadModel> >())) .Returns(new List <GarmentSewingOutDetail>() { new GarmentSewingOutDetail(id, id, new SizeId(1), "sizeName", 1, new UomId(1), "uomUnit") }); // Act var orderData = new { article = "desc", }; string order = JsonConvert.SerializeObject(orderData); var result = await unitUnderTest.GetComplete(1, 25, order, new List <string>(), "", "{}"); // Assert GetStatusCode(result).Should().Equals((int)HttpStatusCode.OK); }