Пример #1
0
            public async Task ReturnsSortedOwners()
            {
                PackageRegistrations.Add(new PackageRegistration
                {
                    Id     = Data.PackageId,
                    Owners = new List <User>
                    {
                        new User {
                            Username = "******"
                        },
                        new User {
                            Username = "******"
                        },
                        new User {
                            Username = "******"
                        },
                        new User {
                            Username = "******"
                        },
                    }
                });

                var owners = await Target.GetOwnersOrEmptyAsync(Data.PackageId);

                Assert.Equal(new[] { "aspnet", "EntityFramework", "Microsoft", "nuget" }, owners);
                EntitiesContextFactory.Verify(x => x.CreateAsync(true), Times.Once);
                EntitiesContextFactory.Verify(x => x.CreateAsync(It.IsAny <bool>()), Times.Once);
            }
Пример #2
0
            public async Task ReturnsEmptyArrayWhenPackageRegistrationHasNoOwners()
            {
                PackageRegistrations.Add(new PackageRegistration
                {
                    Id     = Data.PackageId,
                    Owners = new List <User>(),
                });

                var owners = await Target.GetOwnersOrEmptyAsync(Data.PackageId);

                Assert.Empty(owners);
            }