Ejemplo n.º 1
0
            public async Task CommitChangesIsNotExecuted()
            {
                var testNamespaces           = ReservedNamespaceServiceTestData.GetTestNamespaces();
                var existingNamespace        = testNamespaces.First();
                var testPackageRegistrations = ReservedNamespaceServiceTestData.GetRegistrations();
                var existingReg = testPackageRegistrations.First();
                var service     = new TestableReservedNamespaceService(reservedNamespaces: testNamespaces, packageRegistrations: testPackageRegistrations);

                await service.AddPackageRegistrationToNamespaceAsync(existingNamespace.Value, existingReg, commitChanges : false);

                service
                .MockReservedNamespaceRepository
                .Verify(x => x.CommitChangesAsync(), Times.Never);
                Assert.True(existingNamespace.PackageRegistrations.Contains(existingReg));
            }
Ejemplo n.º 2
0
            public async Task PackageRegistrationIsAddedWithCommitSuccessfully()
            {
                var testNamespaces           = ReservedNamespaceServiceTestData.GetTestNamespaces();
                var existingNamespace        = testNamespaces.First();
                var testPackageRegistrations = ReservedNamespaceServiceTestData.GetRegistrations();
                var existingReg = testPackageRegistrations.First();
                var service     = new TestableReservedNamespaceService(reservedNamespaces: testNamespaces, packageRegistrations: testPackageRegistrations);

                await service.AddPackageRegistrationToNamespaceAsync(existingNamespace.Value, existingReg, commitChanges : true);

                service
                .MockReservedNamespaceRepository
                .Verify(x => x.CommitChangesAsync());
                Assert.True(existingNamespace.PackageRegistrations.Contains(existingReg));
            }
Ejemplo n.º 3
0
            public async Task NullPackageRegistrationThrowsException()
            {
                var service = new TestableReservedNamespaceService();

                await Assert.ThrowsAsync <ArgumentNullException>(async() => await service.AddPackageRegistrationToNamespaceAsync("Microsoft.", null));
            }
Ejemplo n.º 4
0
            public async Task NonExistentNamespaceThrowsException()
            {
                var testNamespaces           = ReservedNamespaceServiceTestData.GetTestNamespaces();
                var testPackageRegistrations = ReservedNamespaceServiceTestData.GetRegistrations();
                var existingReg = testPackageRegistrations.First();
                var service     = new TestableReservedNamespaceService(reservedNamespaces: testNamespaces, packageRegistrations: testPackageRegistrations);

                await Assert.ThrowsAsync <InvalidOperationException>(async() => await service.AddPackageRegistrationToNamespaceAsync("Non.Existent.Namespace.", existingReg));
            }
Ejemplo n.º 5
0
            public async Task NullNamespaceThrowsException(string value)
            {
                var service = new TestableReservedNamespaceService();

                await Assert.ThrowsAsync <ArgumentException>(async() => await service.AddPackageRegistrationToNamespaceAsync(value, new PackageRegistration()));
            }