public void AnalysisProvider_PersonAnalyzesArePropelyLoaded_ShouldPass(string firstName, string lastName, string middleName, string birthDate) { var person = new Person(firstName, lastName, middleName, DateTime.Parse(birthDate)); _personProvider.Save(ref person); var template = new Template("name" + firstName, "content"); _templateProvider.Save(template); var expectedAnalysis = new Analysis(template, person); _analysisProvider.Save(ref expectedAnalysis); IList <Analysis> analyzes = _analysisProvider.Load(person); _analysisProvider.Remove(expectedAnalysis); _personProvider.Remove(person); _templateProvider.Remove(template); Analysis actualAnalysis = analyzes[0]; Assert.True(analyzes.Count() == 1); Assert.True(AnalyzesAreEqual(expectedAnalysis, actualAnalysis)); }
private void SaveAnalysisButton_Click(object sender, RoutedEventArgs e) { var analysis = GetAnalysis(); var analysisProvider = new AnalysisProvider(new DatabaseProvider()); if (analysis.New) { CurrentState.CurrentAnalysis.New = false; analysisProvider.Save(ref analysis); } else { analysisProvider.Update(analysis); } ChangeOpacity(SaveAnalysisButton, 350); }