public void GetRegisterItemByVersionNr() { var register = NewRegister("Register name"); var versions = GetListOfVersions("itemName", register, "kartverket"); var registerItemService = new RegisterItemService(CreateTestDbContext(versions)); var actualVersion = registerItemService.GetRegisterItem(null, register.seoname, "itemname", 2); actualVersion.Should().Be(versions[1]); }
public void GetCurrentRegisterItem() { var register = NewRegister("Register name"); var versions = GetListOfVersions("itemName", register, "Kartverket"); var registerItemService = new RegisterItemService(CreateTestDbContext(versions)); var actualCurrentVersion = registerItemService.GetCurrentRegisterItem(null, register.seoname, versions[1].seoname); actualCurrentVersion.Should().Be(versions[0]); }
public void GetVersionsOfItem() { var register = NewRegister("Register name"); register.parentRegister = NewRegister("Parentregister name"); var versions = GetListOfVersions("itemName", register, "Kartverket"); var registerItemService = new RegisterItemService(CreateTestDbContext(versions)); var actualListOfVersions = registerItemService.GetAllVersionsOfItem(register.parentRegister.seoname, register.seoname, versions[1].seoname); actualListOfVersions.Count.Should().Be(5); }
public void GetRegisterItemByOrganization() { var register = NewRegister("Register name"); var versions = GetListOfVersions("itemName", register, "Kartverket"); var versionsFromOtherOrganization = GetListOfVersions("itemName2", register, "Kartverket"); foreach (var item in versionsFromOtherOrganization) { versions.Add(item); } var registerItemService = new RegisterItemService(CreateTestDbContext(versions)); var actualVersion = registerItemService.GetRegisterItemsFromOrganization(null, register.seoname, "kartverket"); actualVersion.Count.Should().Be(2); }