public void NonExistentNamespaceThrowsException()
            {
                var testNamespaces           = ReservedNamespaceServiceTestData.GetTestNamespaces();
                var testPackageRegistrations = ReservedNamespaceServiceTestData.GetRegistrations();
                var existingReg = testPackageRegistrations.First();
                var service     = new TestableReservedNamespaceService(reservedNamespaces: testNamespaces, packageRegistrations: testPackageRegistrations);

                Assert.Throws <InvalidOperationException>(() => service.AddPackageRegistrationToNamespace("Non.Existent.Namespace.", existingReg));
            }
            public void PackageRegistrationIsAddedSuccessfully()
            {
                var testNamespaces           = ReservedNamespaceServiceTestData.GetTestNamespaces();
                var existingNamespace        = testNamespaces.First();
                var testPackageRegistrations = ReservedNamespaceServiceTestData.GetRegistrations();
                var existingReg = testPackageRegistrations.First();
                var service     = new TestableReservedNamespaceService(reservedNamespaces: testNamespaces, packageRegistrations: testPackageRegistrations);

                service.AddPackageRegistrationToNamespace(existingNamespace.Value, existingReg);

                Assert.True(existingNamespace.PackageRegistrations.Contains(existingReg));
            }
            public void 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);

                service.AddPackageRegistrationToNamespace(existingNamespace.Value, existingReg);

                service
                .MockReservedNamespaceRepository
                .Verify(x => x.CommitChangesAsync(), Times.Never);
            }
            public void NullPackageRegistrationThrowsException()
            {
                var service = new TestableReservedNamespaceService();

                Assert.Throws <ArgumentNullException>(() => service.AddPackageRegistrationToNamespace("Microsoft.", null));
            }
            public void NullNamespaceThrowsException(string value)
            {
                var service = new TestableReservedNamespaceService();

                Assert.Throws <ArgumentException>(() => service.AddPackageRegistrationToNamespace(value, new PackageRegistration()));
            }