public void AssemblyModelService_GetAsync_ReturnsAssemblyModelsByIds()
        {
            //Arrange
            var mockDbContextScopeFac = new Mock<IDbContextScopeFactory>();
            var mockDbContextScope = new Mock<IDbContextReadOnlyScope>();
            var mockEfDbContext = new Mock<EFDbContext>();
            mockDbContextScopeFac.Setup(x => x.CreateReadOnly(DbContextScopeOption.JoinExisting)).Returns(mockDbContextScope.Object);
            mockDbContextScope.Setup(x => x.DbContexts.Get<EFDbContext>()).Returns(mockEfDbContext.Object);

            var dbEntry1 = new AssemblyModel { Id = "dummyEntryId1", AssyModelName = "Name1", AssyModelAltName = "NameAlt1", IsActive_bl = false };
            var dbEntry2 = new AssemblyModel { Id = "dummyEntryId2", AssyModelName = "Name2", AssyModelAltName = "NameAlt2", IsActive_bl = true };
            var dbEntry3 = new AssemblyModel { Id = "dummyEntryId3", AssyModelName = "Name3", AssyModelAltName = "NameAlt3", IsActive_bl = true };
            var dbEntries = (new List<AssemblyModel> { dbEntry1, dbEntry2, dbEntry3 }).AsQueryable();

            var mockDbSet = new Mock<DbSet<AssemblyModel>>();
            mockDbSet.As<IDbAsyncEnumerable<AssemblyModel>>().Setup(m => m.GetAsyncEnumerator()).Returns(new MockDbAsyncEnumerator<AssemblyModel>(dbEntries.GetEnumerator()));
            mockDbSet.As<IQueryable<AssemblyModel>>().Setup(m => m.Provider).Returns(new MockDbAsyncQueryProvider<AssemblyModel>(dbEntries.Provider));
            mockDbSet.As<IQueryable<AssemblyModel>>().Setup(m => m.Expression).Returns(dbEntries.Expression);
            mockDbSet.As<IQueryable<AssemblyModel>>().Setup(m => m.ElementType).Returns(dbEntries.ElementType);
            mockDbSet.As<IQueryable<AssemblyModel>>().Setup(m => m.GetEnumerator()).Returns(dbEntries.GetEnumerator());
            mockDbSet.Setup(x => x.Include(It.IsAny<string>())).Returns(mockDbSet.Object);

            mockEfDbContext.Setup(x => x.AssemblyModels).Returns(mockDbSet.Object);

            var assyModelService = new AssemblyModelService(mockDbContextScopeFac.Object, "DummyUserId");

            //Act
            var serviceResult = assyModelService.GetAsync(new string[] { "dummyEntryId3" }).Result;

            //Assert
            Assert.IsTrue(serviceResult.Count == 1);
            Assert.IsTrue(serviceResult[0].AssyModelAltName.Contains("NameAlt3"));

        }
 public async Task<ActionResult> Edit(AssemblyModel[] records)
 {
     ViewBag.ServiceName = "AssemblyModelService.EditAsync";
     var newEntryIds = await assyModelService.EditAsync(records).ConfigureAwait(false);
     return DbJson(new { Success = "True", newEntryIds = newEntryIds });
 }