public void SearchClient() { var option = new DbContextOptionsBuilder <appcontext>() .UseInMemoryDatabase(databaseName: "SearchClient") .Options; using (var context = new appcontext(option)) { var client = new client(); client.name = "Flávio"; client.cpf = "04745578840"; var clientservice = new clientservice(context); clientservice.CreateClient(client); } using (var context = new appcontext(option)) { var client = new client(); client.cpf = "04745578840"; var service = new clientservice(context); client clients = service.SearchClient(client); Assert.Equal("Flávio", clients.name); Assert.Equal("04745578840", clients.cpf); Assert.Equal(1, clients.id); } }
public void CreateApplication() { var option = new DbContextOptionsBuilder <appcontext>() .UseInMemoryDatabase(databaseName: "CreateApplication") .Options; using (var context = new appcontext(option)) { var application = new application(); application.client = new client(); application.client.name = "Flávio"; application.client.cpf = "04745578840"; application.productfinancial = new productfinancial(); application.productfinancial.name = "Tesouro Direto"; application.productfinancial.percentageyieldyear = 10; application.valueapplication = 5000; application.dateapplication = DateTime.Now; var applicationservice = new applicationservice(context); applicationservice.CreateApplication(application); } using (var context = new appcontext(option)) { Assert.Equal(1, context.applications.Count()); Assert.Equal(1, context.clients.Single().id); Assert.Equal("Flávio", context.clients.Single().name); Assert.Equal("04745578840", context.clients.Single().cpf); Assert.Equal(1, context.productfinancials.Single().id); Assert.Equal("Tesouro Direto", context.productfinancials.Single().name); Assert.Equal(10.0m, context.productfinancials.Single().percentageyieldyear); Assert.Equal(5000m, context.applications.Single().valueapplication); } }
public void SearchProductFinancial() { var option = new DbContextOptionsBuilder <appcontext>() .UseInMemoryDatabase(databaseName: "SearchProductFinancial") .Options; using (var context = new appcontext(option)) { var productfinancial = new productfinancial(); productfinancial.name = "Tesouro Direto"; var productfinancialservice = new productfinancialservice(context); productfinancialservice.CreateProductFinancial(productfinancial); } using (var context = new appcontext(option)) { var productfinancial = new productfinancial(); productfinancial.name = "Tesouro Direto"; var productfinancialservice = new productfinancialservice(context); productfinancial productfinancials = productfinancialservice.SearchProductFinancial(productfinancial); Assert.Equal("Tesouro Direto", productfinancials.name); Assert.Equal(1, productfinancials.id); } }
public void CreateProductFinancial() { var option = new DbContextOptionsBuilder <appcontext>() .UseInMemoryDatabase(databaseName: "CreateProductFinancial") .Options; using (var context = new appcontext(option)) { var productfinancial = new productfinancial(); productfinancial.name = "Tesouro Direto"; productfinancial.percentageyieldyear = 10; var productfinancialservice = new productfinancialservice(context); productfinancialservice.CreateProductFinancial(productfinancial); } using (var context = new appcontext(option)) { Assert.Equal(1, context.productfinancials.Count()); Assert.Equal("Tesouro Direto", context.productfinancials.Single().name); Assert.Equal(10.0m, context.productfinancials.Single().percentageyieldyear); Assert.Equal(1, context.productfinancials.Single().id); } }
public clientservice(appcontext appcontext) { _appcontext = appcontext; }
public applicationservice(appcontext appcontext) { _appcontext = appcontext; }
public productfinancialservice(appcontext appcontext) { _appcontext = appcontext; }