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 AddOrUpdate_ThemeYearFromIsLessThanMinimumConstant_ReturnsNull() { var subthemeUnderTest = ModelsSetup.GetSubthemeUnderTest(Guid.NewGuid().ToString()); subthemeUnderTest.Theme.YearFrom = Constants.MinimumSetYear - 1; var subtheme = _subthemeRepository.AddOrUpdate(subthemeUnderTest); Check.That(subtheme).IsNull(); }
public void Get_SubthemeExists_ReturnModel() { var subthemeUnderTest = ModelsSetup.GetSubthemeUnderTest(Guid.NewGuid().ToString()); InsertData(subthemeUnderTest.Theme); InsertData(subthemeUnderTest); var subtheme = _subthemeRepository.Get(subthemeUnderTest.Theme.Name, subthemeUnderTest.Name); Check.That(subtheme).IsNotNull(); Check.That(subtheme.Name).IsEqualTo(subthemeUnderTest.Name); }
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 AddOrUpdate_NewValidSubtheme_InsertsModel() { var subthemeUnderTest = ModelsSetup.GetSubthemeUnderTest(Guid.NewGuid().ToString()); InsertData(subthemeUnderTest.Theme); _subthemeRepository.AddOrUpdate(subthemeUnderTest); var subtheme = _subthemeRepository.Get(subthemeUnderTest.Theme.Name, subthemeUnderTest.Name); Check.That(subtheme).IsNotNull(); Check.That(subtheme.Name).IsEqualTo(subthemeUnderTest.Name); }
public void AddOrUpdate_ExistingValidSubtheme_UpdatesModel() { var subtheme = ModelsSetup.GetSubthemeUnderTest(Guid.NewGuid().ToString()); InsertData(subtheme.Theme); _subthemeRepository.AddOrUpdate(subtheme); var subthemeUnderTest = _subthemeRepository.Get(subtheme.Theme.Name, subtheme.Name); subthemeUnderTest.SetCount = 66; subthemeUnderTest.YearTo = 2099; _subthemeRepository.AddOrUpdate(subthemeUnderTest); var savedSubtheme = _subthemeRepository.Get(subtheme.Theme.Name, subtheme.Name); Check.That(savedSubtheme).IsNotNull(); Check.That(savedSubtheme.SetCount).IsEqualTo(subthemeUnderTest.SetCount); Check.That(savedSubtheme.YearTo).IsEqualTo(subthemeUnderTest.YearTo); }