예제 #1
0
        public void CanSwitchSpaceContextWhenRepositoryScopeIsUnspecified()
        {
            var repository = Substitute.For <IOctopusAsyncRepository>();

            repository.Scope.Returns(RepositoryScope.Unspecified());
            repository.Teams.UsingContext(SpaceContext.AllSpaces());
        }
예제 #2
0
        public async Task NonSingleSpaceContextShouldNotChangeExistingSpaceId(string spaceIdsToUse, bool includeSystem)
        {
            var spaceIds = spaceIdsToUse.Split(',');
            var client   = SetupAsyncClient();
            await client.Create(Arg.Any <string>(), Arg.Do <TeamResource>(t => t.SpaceId.Should().Be("Spaces-4"))).ConfigureAwait(false);

            var teamRepo    = new TeamsRepository(new OctopusAsyncRepository(client, RepositoryScope.Unspecified()));
            var multiScoped = teamRepo.UsingContext(SpaceContext.SpecificSpacesAndSystem(spaceIds.Select(CreateSpaceResource)));
            var _           = await multiScoped.Create(new TeamResource()
            {
                Name = "Test", SpaceId = "Spaces-4"
            }).ConfigureAwait(false);
        }
예제 #3
0
        public async Task NonSingleSpaceContextShouldNotEnrichSpaceId(string includingSpaceId, bool includeSystem)
        {
            var client = SetupAsyncClient();
            await client.Create(Arg.Any <string>(), Arg.Do <TeamResource>(t =>
            {
                t.SpaceId.Should().BeNullOrEmpty();
            })).ConfigureAwait(false);

            var includingSpaceContext = includeSystem ? SpaceContext.SpecificSpaceAndSystem(CreateSpaceResource(includingSpaceId)) : SpaceContext.SpecificSpace(CreateSpaceResource(includingSpaceId));
            var teamRepo    = new TeamsRepository(new OctopusAsyncRepository(client, RepositoryScope.Unspecified()));
            var multiScoped = teamRepo.UsingContext(includingSpaceContext);
            var _           = await multiScoped.Create(new TeamResource()
            {
                Name = "Test"
            }).ConfigureAwait(false);
        }
예제 #4
0
 public static void SetupScopeAsUnspecifiedWithDefaultSpaceDisabled(this IOctopusAsyncRepository repo)
 {
     repo.Scope.Returns(RepositoryScope.Unspecified());
     repo.LoadSpaceRootDocument().Returns((SpaceRootResource)null);
 }
예제 #5
0
 public static void SetupScopeAsUnspecified(this IOctopusAsyncRepository repo)
 {
     repo.Scope.Returns(RepositoryScope.Unspecified());
     repo.LoadSpaceRootDocument().Returns(new SpaceRootResource());
 }