public void InitilizeTests() { this.dbContext = MockDbContext.GetContext(); var mapper = MockAutomapper.GetMapper(); this.service = new AdminSectionsService(dbContext, mapper); }
public async Task TestCopySetsTheCreatorToCurrectUserWhenNotAdmin() { // Arrange Order savedResult = null; MockDbContext.Setup(a => a.Add(It.IsAny <Order>())).Callback <Order>(r => savedResult = r); var copiedOrder = CreateValidEntities.Order(7); copiedOrder.Creator = CreateValidEntities.User(5, true); OrderData[1].CreatorId = "xxx"; OrderData[1].Creator = CreateValidEntities.User(5); MockOrderService.Setup(a => a.DuplicateOrder(OrderData[1], false)).ReturnsAsync(copiedOrder); // Act var controllerResult = await Controller.Copy(SpecificGuid.GetGuid(2)); // Assert MockOrderService.Verify(a => a.DuplicateOrder(OrderData[1], false), Times.Once); MockDbContext.Verify(a => a.Add(It.IsAny <Order>()), Times.Once); MockDbContext.Verify(a => a.SaveChangesAsync(new CancellationToken()), Times.Once); savedResult.ShouldNotBeNull(); savedResult.CreatorId.ShouldBe("Creator1"); savedResult.Creator.Id.ShouldBe("Creator1"); savedResult.ShareIdentifier.ShouldNotBe(SpecificGuid.GetGuid(2)); savedResult.SavedTestDetails.ShouldBeNull(); var redirectResult = Assert.IsType <RedirectToActionResult>(controllerResult); redirectResult.ActionName.ShouldBe("Edit"); redirectResult.ControllerName.ShouldBeNull(); redirectResult.RouteValues["id"].ShouldBe(savedResult.Id); }
public void Delete_WithValidId_ShouldRedirectToModeratorCommentsAll() { var dbContext = new MockDbContext().GetContext(); var author = new User() { Id = "1" }; dbContext.Comments.Add(new Comment() { Id = 2, Author = author }); var notificationSender = new Mock <INotificationSender>(); notificationSender.Setup(ns => ns.SendNotification(It.IsAny <string>(), It.IsAny <MessageType>(), It.IsAny <Controller>(), It.IsAny <PageModel>())) .Returns(true); var controller = new CommentsController(dbContext, notificationSender.Object, null); var result = controller.Delete(2) as RedirectToActionResult; Assert.AreEqual(result.ActionName, "all"); Assert.AreEqual(result.ControllerName, "comments"); Assert.AreEqual(result.RouteValues["area"], "moderator"); }
public void All_WithSomeFeedback_ShouldReturnView() { //Arrange var dbContext = new MockDbContext().GetContext(); var feedback = new List <Feedback>() { new Feedback() { Id = 1 }, new Feedback() { Id = 2 }, new Feedback() { Id = 3 }, new Feedback() { Id = 4 } }; dbContext.Feedbacks.AddRange(feedback); dbContext.SaveChanges(); //Act var controller = new FeedbackController(dbContext); var result = controller.All(); //Assert Assert.IsInstanceOfType(result as ViewResult, typeof(ViewResult)); }
public async Task TestConfirmationPostWhenUcdAccountVerified() { // Arrange OrderData[1].CreatorId = "Creator1"; OrderData[1].Status = OrderStatusCodes.Created; OrderData[1].PaymentType = PaymentTypeCodes.UcDavisAccount; Controller.ErrorMessage = null; var orderDetails = CreateValidEntities.OrderDetails(2); orderDetails.Payment.Account = "3-1234567"; orderDetails.Payment.AccountName = "WHAT!"; orderDetails.ClientInfo.ClientId = null; OrderData[1].SaveDetails(orderDetails); MockFinancialService.Setup(a => a.GetAccountName(It.IsAny <string>())).ReturnsAsync("My Fake Account"); // Act var controllerResult = await Controller.Confirmation(2, true); // Assert Controller.ErrorMessage.ShouldBeNull(); OrderData[1].GetOrderDetails().Payment.AccountName.ShouldBe("My Fake Account"); MockDbContext.Verify(a => a.SaveChangesAsync(new CancellationToken()), Times.Once); MockFinancialService.Verify(a => a.GetAccountName("3-1234567"), Times.Once); MockOrderService.Verify(a => a.UpdateAdditionalInfo(OrderData[1]), Times.Once); MockOrderService.Verify(a => a.UpdateTestsAndPrices(OrderData[1]), Times.Once); var redirectResult = Assert.IsType <RedirectToActionResult>(controllerResult); redirectResult.ActionName.ShouldBe("Confirmed"); redirectResult.RouteValues["id"].ShouldBe(2); redirectResult.ControllerName.ShouldBeNull(); }
public RestaurantImagesControllerTests() { this.dbContext = MockDbContext.GetContext(); this.configuration = new ConfigurationBuilder() .AddJsonFile("settings.json") .Build(); this.restaurantImagesRepository = new EfDeletableEntityRepository <RestaurantImage>(this.dbContext); this.restaurantRepository = new EfDeletableEntityRepository <Restaurant>(this.dbContext); this.userRepository = new EfDeletableEntityRepository <ApplicationUser>(this.dbContext); this.voteRepository = new EfRepository <Vote>(this.dbContext); this.commentRepository = new EfDeletableEntityRepository <Comment>(this.dbContext); this.voteService = new VoteService(this.voteRepository); this.commentService = new CommentService(this.commentRepository, this.voteService); this.userImageService = new UserImageService(this.userRepository, this.cloudinaryService); this.cloudinaryService = new CloudinaryImageService(this.configuration); this.restaurantImagesService = new RestaurantImageService(this.restaurantImagesRepository, this.cloudinaryService); this.restaurantService = new RestaurantService(this.restaurantRepository, this.restaurantImagesService, this.commentService); this.userService = new UserService(this.restaurantService, this.userImageService, this.userRepository); var httpContext = new DefaultHttpContext(); var tempData = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>()); this.controller = new RestaurantImagesController(this.restaurantImagesService, this.userService, this.restaurantService) { TempData = tempData, }; }
public void TestInitializer() { _mockDbContext = new MockDbContext(); _organizationsDbSet = Substitute.For <DbSet <Organization>, IQueryable <Organization>, IDbAsyncEnumerable <Organization> >(); _organizationsDbSet.SetDbSetDataForAsync(_mockDbContext.Organizations); _usersDbSet = Substitute.For <DbSet <ApplicationUser>, IQueryable <ApplicationUser>, IDbAsyncEnumerable <ApplicationUser> >(); _usersDbSet.SetDbSetDataForAsync(_mockDbContext.ApplicationUsers); var mockDbSqlQuery = Substitute.For <DbSqlQuery <ApplicationUser>, IDbAsyncEnumerable <ApplicationUser> >(); var asyncEnumerator = new MockDbAsyncEnumerator <ApplicationUser>(_mockDbContext.ApplicationUsers.GetEnumerator()); ((IDbAsyncEnumerable <ApplicationUser>)mockDbSqlQuery).GetAsyncEnumerator().Returns(asyncEnumerator); mockDbSqlQuery.AsNoTracking().Returns(mockDbSqlQuery); mockDbSqlQuery.GetEnumerator().Returns(_mockDbContext.ApplicationUsers.GetEnumerator()); _usersDbSet.SqlQuery(Arg.Any <string>(), Arg.Any <object[]>()) .Returns(mockDbSqlQuery); _uow = Substitute.For <IUnitOfWork2>(); _uow.GetDbSet <ApplicationUser>().ReturnsForAnyArgs(_usersDbSet); _uow.GetDbSet <Organization>().ReturnsForAnyArgs(_organizationsDbSet); _pictureService = Substitute.For <IPictureService>(); _usersAnonymizationWebHookService = new UsersAnonymizationWebHookService(_uow, _pictureService); }
public async Task TestSaveWhenCreateAndSuccess() { // Arrange var model = new OrderSaveModel(); model.OrderId = null; Order savedResult = null; MockDbContext.Setup(a => a.Add(It.IsAny <Order>())).Callback <Order>(r => savedResult = r); // Act var controllerResult = await Controller.Save(model); // Assert var result = Assert.IsType <JsonResult>(controllerResult); dynamic data = JObject.FromObject(result.Value); ((bool)data.success).ShouldBe(true); ((int)data.id).ShouldBe(0); //Because it would be set in the DB MockOrderService.Verify(a => a.PopulateTestItemModel(It.IsAny <bool>()), Times.Once); MockOrderService.Verify(a => a.PopulateOrder(model, It.IsAny <Order>()), Times.Once); MockDbContext.Verify(a => a.Add(It.IsAny <Order>()), Times.Once); MockDbContext.Verify(a => a.SaveChangesAsync(new CancellationToken()), Times.Once); savedResult.CreatorId.ShouldBe("Creator1"); savedResult.Creator.ShouldNotBeNull(); savedResult.Creator.Id.ShouldBe("Creator1"); savedResult.Status.ShouldBe(OrderStatusCodes.Created); savedResult.ShareIdentifier.ShouldNotBeNull(); }
public void Demote_WithValidId_ShouldRedirectToAdminUsersAll() { //Arrange var dbContext = new MockDbContext().GetContext(); var user = new User() { Id = "aaaaaaa", UserName = "******" }; dbContext.Users.Add(user); dbContext.SaveChanges(); var mockUserStore = new Mock <IUserStore <User> >(); var mockUserManager = new Mock <UserManager <User> >( mockUserStore.Object, null, null, null, null, null, null, null, null); var notificationSender = new Mock <INotificationSender>(); notificationSender.Setup(ns => ns.SendNotification(It.IsAny <string>(), It.IsAny <MessageType>(), It.IsAny <Controller>(), It.IsAny <PageModel>())) .Returns(true); var controller = new UsersController(dbContext, mockUserManager.Object, notificationSender.Object); //Act var result = controller.Demote("aaaaaaa").Result as RedirectToActionResult; //Assert Assert.AreEqual("admin", result.RouteValues["area"]); Assert.AreEqual("users", result.RouteValues["controller"]); Assert.AreEqual("All", result.ActionName); }
public void All_WithZeroUsers_ReturnsView() { //Arrange var dbContext = new MockDbContext().GetContext(); var users = new List <User>(); dbContext.Users.AddRange(users); dbContext.SaveChanges(); var mockUserStore = new Mock <IUserStore <User> >(); var mockUserManager = new Mock <UserManager <User> >( mockUserStore.Object, null, null, null, null, null, null, null, null); mockUserManager.Setup(um => um.GetUserAsync(null)) .ReturnsAsync(new User() { Id = "111" }); var controller = new UsersController(dbContext, mockUserManager.Object, null); //Act var result = controller.All(); Assert.IsInstanceOfType(result, typeof(ViewResult)); }
public void InitializeTests() { this.dbContext = MockDbContext.GetDbContext(); var mapper = MockAutoMapper.GetMapper(); this.service = new AdminVideosService(dbContext, mapper); }
public CategoriesControllerTests() { this.dbContext = MockDbContext.GetContext(); this.configuration = new ConfigurationBuilder() .AddJsonFile("settings.json") .Build(); this.restaurantImagesRepository = new EfDeletableEntityRepository <RestaurantImage>(this.dbContext); this.categoryImageRepository = new EfDeletableEntityRepository <CategoryImage>(this.dbContext); this.restaurantRepository = new EfDeletableEntityRepository <Restaurant>(this.dbContext); this.categoryRepository = new EfDeletableEntityRepository <Category>(this.dbContext); this.favouriteRepository = new EfRepository <FavouriteRestaurant>(this.dbContext); this.voteRepository = new EfRepository <Vote>(this.dbContext); this.commentRepository = new EfDeletableEntityRepository <Comment>(this.dbContext); this.voteService = new VoteService(this.voteRepository); this.commentService = new CommentService(this.commentRepository, this.voteService); this.cloudinaryService = new CloudinaryImageService(this.configuration); this.restaurantImagesService = new RestaurantImageService(this.restaurantImagesRepository, this.cloudinaryService); this.restaurantService = new RestaurantService(this.restaurantRepository, this.restaurantImagesService, this.commentService); this.categoryImageService = new CategoryImageService(this.categoryImageRepository, this.cloudinaryService); this.categoryService = new CategoryService(this.categoryRepository, this.categoryImageService, this.restaurantService); this.favouriteService = new FavouriteService(this.favouriteRepository); var httpContext = new DefaultHttpContext(); var tempData = new TempDataDictionary(httpContext, Mock.Of <ITempDataProvider>()); this.controller = new CategoriesController(this.categoryService, this.restaurantService, this.favouriteService) { TempData = tempData, }; AutoMapperConfig.RegisterMappings(typeof(ErrorViewModel).Assembly); }
public void InitializeTests() { this.dbContext = MockDbContext.GetContext(); this.mapper = MockAutoMapper.GetAutoMapper(); this.postService = new PostService(dbContext, mapper); this.postController = new PostsController(postService, mapper); }
public void InitilizeTests() // runs befor every test { this.dbContext = MockDbContext.GetContext(); var mapper = MockAutomapper.GetMapper(); this.service = new AdminCoursesService(dbContext, mapper); }
public void Initialize() { this.context = MockDbContext.GetContext(); this.scoreService = new Mock <IScoreService>().Object; this.historyService = new Mock <IHistoryService>().Object; this.userService = new UserService(context, scoreService, historyService); }
public async Task TestSaveWhenEditAndSuccess() { // Arrange OrderData[1].Status = OrderStatusCodes.Created; OrderData[1].CreatorId = "Creator1"; var model = new OrderSaveModel(); model.OrderId = 2; OrderData[1].SavedTestDetails.ShouldBeNull(); // Act var controllerResult = await Controller.Save(model); // Assert var result = Assert.IsType <JsonResult>(controllerResult); dynamic data = JObject.FromObject(result.Value); ((bool)data.success).ShouldBe(true); ((int)data.id).ShouldBe(2); MockOrderService.Verify(a => a.PopulateTestItemModel(It.IsAny <bool>()), Times.Once); MockOrderService.Verify(a => a.PopulateOrder(model, OrderData[1]), Times.Once); MockDbContext.Verify(a => a.SaveChangesAsync(new CancellationToken()), Times.Once); OrderData[1].SavedTestDetails.ShouldNotBeNull(); OrderData[1].GetTestDetails().Count.ShouldBe(10); }
public static IServiceCollection ResolveDalDependencies(this IServiceCollection services) { services.AddScoped(c => MockDbContext.GetInstance()); services.AddScoped <IRepository <Note>, NoteRepository>(); return(services); }
public async Task TestConfirmationPostWhenUcdAccountNotVerified2() { // Arrange OrderData[1].CreatorId = "Creator1"; OrderData[1].Status = OrderStatusCodes.Created; OrderData[1].PaymentType = PaymentTypeCodes.UcDavisAccount; Controller.ErrorMessage = null; var orderDetails = CreateValidEntities.OrderDetails(2); orderDetails.Payment.Account = "3-1234567"; orderDetails.Payment.AccountName = "WHAT!"; OrderData[1].SaveDetails(orderDetails); MockFinancialService.Setup(a => a.GetAccountName(It.IsAny <string>())).ReturnsAsync(string.Empty); // Act var controllerResult = await Controller.Confirmation(2, true); // Assert Controller.ErrorMessage.ShouldBe("Unable to verify UC Account number. Please edit your order and re-enter the UC account number. Then try again."); OrderData[1].GetOrderDetails().Payment.AccountName.ShouldBeEmpty(); MockDbContext.Verify(a => a.SaveChangesAsync(new CancellationToken()), Times.Once); MockFinancialService.Verify(a => a.GetAccountName("3-1234567"), Times.Once); var redirectResult = Assert.IsType <RedirectToActionResult>(controllerResult); redirectResult.ActionName.ShouldBe("Confirmation"); redirectResult.RouteValues["id"].ShouldBe(2); redirectResult.ControllerName.ShouldBeNull(); }
public void Add_Try_With_Extention() { var aUser = new User { Id = 100, Name = "The User", Email = "Email" }; List <User> users = Builder <User> .CreateListOfSize(5).Build().ToList(); var dbContextMock = new MockDbContext <IUmsDbContext>(); dbContextMock.SetupDbSet(x => x.Users) .SetUp(x => x.Add(It.IsAny <User>())) .Callback((User lol) => users.Add(lol)) .Returns((User lol) => lol) .Mock() .WithData(users); var logic = new UserLogic(dbContextMock.Object); logic.Add(aUser); Assert.AreEqual(6, dbContextMock.Object.Users.Select(x => x).ToList().Count); }
public async Task TestConfirmationPostWhenPaymentOther2() { // Arrange OrderData[1].CreatorId = "Creator1"; OrderData[1].Status = OrderStatusCodes.Created; OrderData[1].PaymentType = PaymentTypeCodes.Other; Controller.ErrorMessage = null; var orderDetails = CreateValidEntities.OrderDetails(2); orderDetails.OtherPaymentInfo.PaymentType = "SomethingElse"; orderDetails.ClientInfo.ClientId = null; OrderData[1].SaveDetails(orderDetails); // Act var controllerResult = await Controller.Confirmation(2, true); // Assert Controller.ErrorMessage.ShouldBeNull(); OrderData[1].GetOrderDetails().Payment.AccountName.ShouldBeNull(); MockDbContext.Verify(a => a.SaveChangesAsync(new CancellationToken()), Times.Once); MockFinancialService.Verify(a => a.GetAccountName(It.IsAny <string>()), Times.Never); MockOrderMessagingService.Verify(a => a.EnqueueBillingMessage(OrderData[1], It.IsAny <string>()), Times.Never); MockOrderService.Verify(a => a.UpdateTestsAndPrices(OrderData[1]), Times.Once); MockOrderService.Verify(a => a.UpdateAdditionalInfo(OrderData[1]), Times.Once); MockLabworksService.Verify(a => a.GetClientDetails(It.IsAny <string>()), Times.Never); MockOrderMessagingService.Verify(a => a.EnqueueCreatedMessage(OrderData[1]), Times.Once); var redirectResult = Assert.IsType <RedirectToActionResult>(controllerResult); redirectResult.ActionName.ShouldBe("Confirmed"); redirectResult.RouteValues["id"].ShouldBe(2); redirectResult.ControllerName.ShouldBeNull(); }
public void Add_Fields() { var aUser = new User { Id = 100, Name = "The User", Email = "Email" }; List <User> users = Builder <User> .CreateListOfSize(5).Build().ToList(); var dbContextMock = new MockDbContext <IUmsDbContext>(); dbContextMock.SetupDbSet(x => x.Users) .SetUp(x => x.Add(It.IsAny <User>())) .Callback((User lol) => users.Add(lol)) .Returns((User lol) => lol) .Mock() .WithData(users); var logic = new UserLogic(dbContextMock.Object); logic.Add(aUser); User addedUser = dbContextMock.Object.Users.Last(); Assert.AreEqual(aUser.Name, addedUser.Name); Assert.AreEqual(aUser.Email, addedUser.Email); }
public void InitializeTests() { this.dbContext = MockDbContext.GetContext(); this.interviews = new AdminInterviewService(dbContext, MockAutoMapper.GetAutoMapper()); this.applicants = new AdminApplicantService(dbContext, MockAutoMapper.GetAutoMapper()); this.tests = new InterviewerTestsService(dbContext, MockAutoMapper.GetAutoMapper()); }
public void InitializeTests() { this.context = MockDbContext.GetContext(); this.service = new AdminRewardsService(context, MockAutoMapper.GetMapper()); CreateInitialEvents(); }
public void All_WithSomeComments_ShouldReturnView() { var dbContext = new MockDbContext().GetContext(); var author = new User() { Id = "1" }; dbContext.Comments.AddRange(new List <Comment>() { new Comment() { Message = "tralala", Author = author }, new Comment() { Message = "asdf", Author = author }, new Comment() { Message = "beep", Author = author } }); dbContext.SaveChanges(); var controller = new CommentsController(dbContext, null, null); var result = controller.All() as ViewResult; Assert.IsInstanceOfType(result, typeof(ViewResult)); }
public void TestCopySetsTheCreatorToCurrectUserWhenAdminIsTrueButNotAdminRole() { // Arrange Order savedResult = null; MockDbContext.Setup(a => a.Add(It.IsAny <Order>())).Callback <Order>(r => savedResult = r); var copiedOrder = CreateValidEntities.Order(7); copiedOrder.Creator = CreateValidEntities.User(5, true); OrderData[1].CreatorId = "xxx"; OrderData[1].Creator = CreateValidEntities.User(5); MockOrderService.Setup(a => a.DuplicateOrder(OrderData[1], true)).ReturnsAsync(copiedOrder); // Act var ex = Assert.ThrowsAsync <Exception>(async() => await Controller.Copy(SpecificGuid.GetGuid(2), true)); // Assert ex.Result.Message.ShouldBe("Permissions Missing"); MockOrderService.Verify(a => a.DuplicateOrder(OrderData[1], true), Times.Once); MockDbContext.Verify(a => a.Add(It.IsAny <Order>()), Times.Never); MockDbContext.Verify(a => a.SaveChangesAsync(new CancellationToken()), Times.Never); }
public void TestOrderByOverwrite() { using (var localContext = new MockDbContext(this.options)) { localContext.Add(new Entity { Id = 1, Name = "za" }); localContext.Add(new Entity { Id = 2, Name = "za" }); localContext.Add(new Entity { Id = 3, Name = "aa" }); localContext.SaveChanges(); } var result = this.context.Entities .OrderBy(e => e.Name) .ThenBy(e => e.Id) .OrderByDescending(e => e.Name) .ThenByDescending(e => e.Id) .ToList(); Assert.Equal(result.Select(e => e.Id), new[] { 2, 1, 3 }); }
public async Task TestViewMessageReturnsView() { // Arrange var mail = new List <MailMessage>(); for (int i = 0; i < 5; i++) { var mm = CreateValidEntities.MailMessage(i + 1); mm.Order = CreateValidEntities.Order(i + 1); mm.User = UserData[i % 2]; mm.Sent = null; mm.SentAt = DateTime.UtcNow.AddDays(-35); mail.Add(mm); } MockDbContext.Setup(a => a.MailMessages).Returns(mail.AsQueryable().MockAsyncDbSet().Object); // Act var controllerResult = await Controller.ViewMessage(3); // Assert var viewResult = Assert.IsType <ViewResult>(controllerResult); var modelResult = Assert.IsType <MailMessage>(viewResult.Model); modelResult.ShouldNotBeNull(); modelResult.Id.ShouldBe(3); }
public void Initialize() { this.dbContext = MockDbContext.GetContext(); var mapper = MockAutoMapper.GetMapper(); this.categories = new CategoryService(this.dbContext, mapper); }
public async Task Should_Load_Childs_In_Orders_By_Application_User_Async() { var context = MockDbContext.CreateDBInMemoryContext(); var applicationUserId = Guid.NewGuid(); var repository = MockOrder.GetDBTestRepository(context); var order = MockOrder.GetEntityFake(); order.ApplicationUserId = applicationUserId; order.OrderItems = new List <OrderItem>() { new OrderItem() { Quantity = 100, Price = 1, Fee = 10, FeeAsset = new Asset() } }; order.BaseAsset = new Asset(); order.QuoteAsset = new Asset(); order.Exchange = new Exchange(); await repository.InsertAsync(order); await repository.InsertAsync(order); await repository.InsertAsync(MockOrder.GetEntityFake()); var result = await repository.GetAllByApplicationUserAsync(applicationUserId); Assert.Equal(2, result.Count); Assert.True(result.First().OrderItems.Any()); }
public void EntityFrameworkEndpointMiddleware_PathAndVerbMatching_ReturnsExpected() { var opts = new DbMigrationsEndpointOptions(); var efContext = new MockDbContext(); var container = Substitute.For <IServiceProvider>(); container.GetService(typeof(MockDbContext)).Returns(efContext); var helper = Substitute.For <DbMigrationsEndpoint.DbMigrationsEndpointHelper>(); helper.GetPendingMigrations(Arg.Any <DbContext>()).Returns(new[] { "pending" }); helper.GetAppliedMigrations(Arg.Any <DbContext>()).Returns(new[] { "applied" }); var ep = new DbMigrationsEndpoint(opts, container, helper); var mgmt = new CloudFoundryManagementOptions() { Path = "/" }; mgmt.EndpointOptions.Add(opts); var middle = new DbMigrationsEndpointMiddleware(null, ep, new List <IManagementOptions> { mgmt }); middle.RequestVerbAndPathMatch("GET", "/dbmigrations").Should().BeTrue(); middle.RequestVerbAndPathMatch("PUT", "/dbmigrations").Should().BeFalse(); middle.RequestVerbAndPathMatch("GET", "/badpath").Should().BeFalse(); }
public ResolveTree(MockDbContext dbContext, ICrudRepository<MockEntity1> repo1, ICrudRepository<MockEntity2> repo2) { DbContext = dbContext; Repo1 = (DbCrudRepository<MockEntity1>)repo1; Repo2 = (DbCrudRepository<MockEntity2>)repo2; }