コード例 #1
0
        public async System.Threading.Tasks.Task GetTarifaTestInvalidRequestAsync()
        {
            var options = new DbContextOptionsBuilder <Context>()
                          .UseSqlite("DataSource=:memory:")
                          .Options;

            // Use a separate instance of the context to verify correct data was saved to database
            using (var context = new Context(options))
            {
                ITarifaRepository tarifaRepository = new TarifaRepository(context);
                TarifaService     tarifaService    = new TarifaService(tarifaRepository);

                var request = new RequestTarifa();
                request.Origem  = 11;
                request.Destino = 199;
                request.Plano   = null;
                request.Tempo   = 40;

                var response = await tarifaService.GetTarifas(request);

                Assert.IsNotNull(response);
                Assert.AreEqual(response.SemFaleMais, 0);
                Assert.AreEqual(response.ComFaleMais, 0);
            }
        }
コード例 #2
0
        public async System.Threading.Tasks.Task GetTarifaTestNullAsync()
        {
            var options = new DbContextOptionsBuilder <Context>()
                          .UseSqlite("DataSource=:memory:")
                          .Options;

            // Use a separate instance of the context to verify correct data was saved to database
            using (var context = new Context(options))
            {
                ITarifaRepository tarifaRepository = new TarifaRepository(context);
                TarifaService     tarifaService    = new TarifaService(tarifaRepository);

                var response = await tarifaService.GetTarifas(null);
            }
        }