示例#1
0
        public void Add_Facture_AddsFactureToDatabase()
        {
            //Arrange
            var client = new Client()
            {
                Nom       = "Carange",
                Prenom    = "Hugues",
                Telephone = "418-123-4567"
            };
            var groupe = new Groupe()
            {
                Nom    = "Sex Pistols",
                Cachet = 10000,
            };
            var contrat = new Contrat()
            {
                Groupe           = groupe,
                IdGroupe         = groupe.Id,
                Client           = client,
                IdClient         = client.Id,
                DateContrat      = new DateTime(2017, 12, 12),
                DatePresentation = new DateTime(2017, 11, 11),
                HeureDebut       = new DateTime(2017, 11, 11, 12, 24, 43),
                HeureFin         = new DateTime(2017, 11, 11, 12, 24, 44),
                Depot            = 11334,
                Cachet           = 2344,
                MontantFinal     = 23545
            };
            var facture = new Facture()
            {
                DateProduction = new DateTime(2017, 12, 12),
                DatePaiement   = new DateTime(2017, 11, 11),
                ModePaiement   = "Comptant",
                Contrat        = contrat,
                IdContrat      = contrat.Id
            };

            //Action
            _factureRepository.Add(facture);

            // Assert
            using (var apiDbContext = _dbContextFactory.Create())
            {
                apiDbContext.Factures.ToList().Count.Should().Be(1);
            }
        }
示例#2
0
        public void Add_Client_AddsClientToDatabase()
        {
            //Arrange
            var client = new Client()
            {
                Nom       = "Carange",
                Prenom    = "Hugues",
                Telephone = "418-123-4567"
            };

            //Action
            _clientRepository.Add(client);

            // Assert
            using (var apiDbContext = _dbContextFactory.Create())
            {
                apiDbContext.Clients.ToList().Count.Should().Be(1);
            }
        }