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.RemovePackageRegistrationFromNamespace("Non.Existent.Namespace.", existingReg)); }
public void PackageRegistrationIsRemovedFromNamespaceSuccessfully() { var testNamespaces = ReservedNamespaceServiceTestData.GetTestNamespaces(); var existingNamespace = testNamespaces.First(); var testPackageRegistrations = ReservedNamespaceServiceTestData.GetRegistrations(); var existingReg = testPackageRegistrations.First(); existingNamespace.PackageRegistrations.Add(existingReg); var service = new TestableReservedNamespaceService(reservedNamespaces: testNamespaces, packageRegistrations: testPackageRegistrations); service.RemovePackageRegistrationFromNamespace(existingNamespace.Value, existingReg); Assert.False(existingNamespace.PackageRegistrations.Contains(existingReg)); }
public void CommitChangesIsNotExecuted() { var testNamespaces = ReservedNamespaceServiceTestData.GetTestNamespaces(); var existingNamespace = testNamespaces.First(); var testPackageRegistrations = ReservedNamespaceServiceTestData.GetRegistrations(); var existingReg = testPackageRegistrations.First(); existingNamespace.PackageRegistrations.Add(existingReg); var service = new TestableReservedNamespaceService(reservedNamespaces: testNamespaces, packageRegistrations: testPackageRegistrations); service.RemovePackageRegistrationFromNamespace(existingNamespace.Value, existingReg); service .MockReservedNamespaceRepository .Verify(x => x.CommitChangesAsync(), Times.Never); }
public void NullPackageRegistrationThrowsException() { var service = new TestableReservedNamespaceService(); Assert.Throws <ArgumentNullException>(() => service.RemovePackageRegistrationFromNamespace("Microsoft.", null)); }
public void NullNamespaceThrowsException(string value) { var service = new TestableReservedNamespaceService(); Assert.Throws <ArgumentException>(() => service.RemovePackageRegistrationFromNamespace(value, new PackageRegistration())); }