24 AgreementName =
"Escali Financials",
25 AgreementCreated = DateTime.Now,
44 var res = await
service.AddAgreement(agreement);
46 Assert.Equal(agreement.AgreementName, res.AgreementName);
47 Assert.NotNull(res.Currency);
48 Assert.NotNull(res.Product);
49 Assert.NotNull(res.Customer);
64 var res = await
service.AddAgreement(agreement);
66 Assert.NotNull(res.AgreementUpdated);
79 agreement.AgreementUpdated = DateTime.Now;
80 var res =
context.Agreements.Add(agreement);
81 await
context.SaveChangesAsync();
83 var lastChanged = res.Entity.AgreementUpdated;
86 var updatedAgreement = await
service.UpdateAgreement(res.Entity);
88 Assert.NotEqual(lastChanged, updatedAgreement.AgreementUpdated);
AgreementService class inserts and updates Agreement in the Database
AgreementService Testing Environment
async void AddAgreement_DateChangedAdded()
passes if correctly added agreeement
async void AddAgreement_Success()
passes if agreement is correctly inserted into agreementlist
async void UpdateAgreement_DateChangedAdded()
passes if correctly updated agreeement-date, and not equal previous set date
Agreement CreateAgreement()
Creates an agreement
static DataContext GetContext()
Creates a testcontext for testing
Reusable methods for inserting information into tests
static DataContext InsertDataForAgreement(DataContext context)
Combined insertion for Currency, Product and Customer into DataContext for broader test option