Exemplo n.º 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);
            }
Exemplo n.º 2
0
            public async Task DisposesEntitiesContext()
            {
                var entitiesContext = new DisposableEntitiesContext();

                EntitiesContextFactory.Setup(x => x.CreateAsync(It.IsAny <bool>())).ReturnsAsync(entitiesContext);

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

                Assert.True(entitiesContext.Disposed, "The entities context should have been disposed.");
            }