public void SubmitDocument(DocumentDto documentDto, AfTestAppContext context)
        {
            var doc = Project(documentDto);

            doc.DocumentStatusId = (int)DocumentStatus.Submitted;
            context.Documents.Add(doc);
            context.SaveChanges();
            documentDto.DocumentId = doc.DocumentId;
        }
 public void SetUp()
 {
     _dbContextFactoryMock = new Mock <IAfTestAppContextFactory>();
     _dbContextMock        = new AfTestAppContext
     {
         Products = new FakeDbSet <Product>()
     };
     _dbContextFactoryMock.Setup(x => x.CreateContext()).Returns(_dbContextMock);
     _service = new ProductService(_dbContextFactoryMock.Object);
 }
 public void CreatedDocumentProducts(DocumentDto documentDto, AfTestAppContext context)
 {
     foreach (var product in documentDto.Products)
     {
         var docProduct = new DocumentProduct();
         docProduct.MapFromObjectWithSameNames(product);
         docProduct.DocumentId = documentDto.DocumentId;
         context.DocumentProduct.Add(docProduct);
     }
 }