예제 #1
0
        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]);
        }
예제 #2
0
        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]);
        }
예제 #3
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);
        }
예제 #4
0
        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);
        }