private Set SetupSetForSearch(int suffix) { var theme = InsertData(ModelsSetup.GetThemeUnderTest($"SET THEME{suffix}")); var subtheme = ModelsSetup.GetSubthemeUnderTest($"SET SUBTHEME{suffix}"); subtheme.Theme = theme; subtheme = InsertData(subtheme); var set = ModelsSetup.GetSetForSearch(suffix); set.SetId = suffix; set.Theme = theme; set.Subtheme = subtheme; set.ThemeGroup = InsertData(new ThemeGroup { Value = $"SET THEMEGROUP{suffix}" }); set.PackagingType = InsertData(new PackagingType { Value = $"SET PACKAGINGTYPE{suffix}" }); set.Category = InsertData(new Category { Value = $"SET CATEGORY{suffix}" }); set.Tags.Add(InsertData(new Tag { Value = $"SET TAG{suffix}" })); return(InsertData(set)); }
public void Get_ThemeExists_ReturnsModel() { var themeUnderTest = InsertData(ModelsSetup.GetThemeUnderTest(Guid.NewGuid().ToString())); var theme = _themeRepository.Get(themeUnderTest.Name); Check.That(theme.Name).IsEqualTo(themeUnderTest.Name); }
public void Get_ThemeDoesNotExist_ReturnsNull() { InsertData(ModelsSetup.GetThemeUnderTest(Guid.NewGuid().ToString())); var theme = _themeRepository.Get(ModelsSetup.NonExistentThemeName); Check.That(theme).IsNull(); }
public void AddOrUpdate_NewValidTheme_InsertsModel() { var themeUnderTest = ModelsSetup.GetThemeUnderTest(Guid.NewGuid().ToString()); _themeRepository.AddOrUpdate(themeUnderTest); var theme = _themeRepository.Get(themeUnderTest.Name); Check.That(theme.Name).IsEqualTo(themeUnderTest.Name); }
public void AddOrUpdate_ThemeYearFromIsLessThanMinimumConstant_ReturnsNull() { var themeUnderTest = ModelsSetup.GetThemeUnderTest(Guid.NewGuid().ToString()); themeUnderTest.YearFrom = Constants.MinimumSetYear - 1; var theme = _themeRepository.AddOrUpdate(themeUnderTest); Check.That(theme).IsNull(); }
public void Get_SubthemeDoesNotExist_ReturnsNull(string themeName, string subthemeName) { var subthemeUnderTest = ModelsSetup.GetSubthemeUnderTest(subthemeName == ModelsSetup.SubthemeUnderTestName ? ModelsSetup.SubthemeUnderTestName : Guid.NewGuid().ToString()); subthemeUnderTest.Theme = InsertData(ModelsSetup.GetThemeUnderTest(themeName == ModelsSetup.ThemeUnderTestName ? themeName : Guid.NewGuid().ToString())); InsertData(subthemeUnderTest); var subtheme = _subthemeRepository.Get(themeName, subthemeName); Check.That(subtheme).IsNull(); }
public void AllForTheme_SetForThemeDoesNotExist_ReturnsEmpty() { var set = ModelsSetup.GetSetUnderTest(); set.Theme = InsertData(ModelsSetup.GetThemeUnderTest(Guid.NewGuid().ToString())); InsertData(set); var allSetsForTheme = _setRepository.AllForTheme(ModelsSetup.NonExistentThemeName); Check.That(allSetsForTheme).IsEmpty(); }
public void AddOrUpdate_ExistingValidTheme_UpdatesModel() { var themeUnderTest = ModelsSetup.GetThemeUnderTest(Guid.NewGuid().ToString()); _themeRepository.AddOrUpdate(themeUnderTest); var themeFromDb = _themeRepository.Get(themeUnderTest.Name); themeFromDb.SetCount = 99; themeFromDb.YearTo = 2099; _themeRepository.AddOrUpdate(themeFromDb); var theme = _themeRepository.Get(themeFromDb.Name); Check.That(theme).HasFieldsWithSameValues(themeFromDb); }