示例#1
0
        public void GetOwnedSets_BricksetUserExists_ReturnsListOfOwnedSets()
        {
            var wantedSet    = ModelsSetup.GetSetUnderTest();
            var ownedSet     = ModelsSetup.GetSecondSetUnderTest();
            var bricksetUser = ModelsSetup.GetBricksetUserUnderTest();

            wantedSet = InsertData(wantedSet);
            ownedSet  = InsertData(ownedSet);
            InsertData(bricksetUser);

            var bricksetUserSetWanted = new BricksetUserSet
            {
                Set    = wantedSet,
                Wanted = true
            };

            var bricksetUserSetOwned = new BricksetUserSet
            {
                Set   = ownedSet,
                Owned = true
            };

            _bricksetUserRepository.AddOrUpdateSet(bricksetUser.BricksetUsername, bricksetUserSetWanted);
            _bricksetUserRepository.AddOrUpdateSet(bricksetUser.BricksetUsername, bricksetUserSetOwned);

            var bricksetUserSetList = _bricksetUserRepository.GetOwnedSets(bricksetUser.BricksetUsername).ToList();

            Check.That(bricksetUserSetList).CountIs(1);
            Check.That(bricksetUserSetList.Select(bricksetUserSet => bricksetUserSet.Set.SetId)).Contains(bricksetUserSetOwned.Set.SetId);
        }