public void Add(Application application) { var applicationAccess = new ApplicationAccess(); var applicationDB = applicationAccess.Get(application.ID); if (applicationDB == null) { applicationAccess.Add(LogicToDB(application)); } }
public void AddApplicationTest() { var application = new Application(); application.Sent = DateTime.Now; application.Message = "Test Message"; application.Result = true; application.BandID = db.Bands.ToList().FirstOrDefault().ID; application.UserID = db.Users.ToList().FirstOrDefault().ID; applicationAccess.Add(application); var application2 = db.Applications.Where(a => a.Message.StartsWith("Test Message") && a.Message.EndsWith("Test Message")).ToList().FirstOrDefault(); Assert.AreEqual(application2.Message, application.Message); }