public void Read_With_EmptyKeyword_Return_Success() { string testName = GetCurrentMethod(); var dbContext = _dbContext(testName); IIdentityService identityService = new IdentityService { Username = "******" }; DOSalesDetailLogic unitUnderTest = new DOSalesDetailLogic(GetServiceProvider(testName).Object, identityService, dbContext); var model = new DOSalesDetailModel() { ColorRequest = "ColorRequest", ColorTemplate = "ColorTemplate", ConstructionName = "ConstructionName" }; dbContext.DOSalesLocalItems.Add(model); dbContext.SaveChanges(); var result = unitUnderTest.Read(1, 1, "{}", new List <string>() { "" }, null, "{}"); Assert.NotEmpty(result.Data); }
protected override Mock <IServiceProvider> GetServiceProviderMock(SalesDbContext dbContext) { var serviceProviderMock = new Mock <IServiceProvider>(); IIdentityService identityService = new IdentityService { Username = "******" }; serviceProviderMock .Setup(x => x.GetService(typeof(IdentityService))) .Returns(identityService); var doSalesLocalLogic = new DOSalesDetailLogic(serviceProviderMock.Object, identityService, dbContext); serviceProviderMock .Setup(x => x.GetService(typeof(DOSalesDetailLogic))) .Returns(doSalesLocalLogic); var doSalesLogic = new DOSalesLogic(serviceProviderMock.Object, identityService, dbContext); serviceProviderMock .Setup(x => x.GetService(typeof(DOSalesLogic))) .Returns(doSalesLogic); return(serviceProviderMock); }