public async Task GetCustomProjectTypesAsync_InvalidUserId() { // Arrange var cxn = new SqlConnectionWrapperMock(); var repository = new SqlProjectMetaRepository(cxn.Object); // Act await repository.GetCustomProjectTypesAsync(2, 0); // Assert }
public async Task GetCustomProjectTypesAsync_ProjectNotFound() { // Arrange var projectId = 1; var userId = 2; SqlProjectMetaRepository.ProjectVersion[] result = { }; var cxn = new SqlConnectionWrapperMock(); var repository = new SqlProjectMetaRepository(cxn.Object); cxn.SetupQueryAsync <SqlProjectMetaRepository.ProjectVersion>("GetInstanceProjectById", new Dictionary <string, object> { { "projectId", projectId }, { "userId", userId } }, result); // Act await repository.GetCustomProjectTypesAsync(projectId, userId); // Assert }
public void Initialize() { _cxn = new SqlConnectionWrapperMock(); _repository = new SqlProjectMetaRepository(_cxn.Object); }
private void TestOrderProperties(SqlProjectMetaRepository.AdvancedSettings advancedSettings, List <int> expectedOrder) { // Arrange var propertyTypes = new List <PropertyType> { new PropertyType { Id = 1, IsRichText = true, IsMultipleAllowed = true, InstancePropertyTypeId = 101 }, new PropertyType { Id = 2, IsRichText = true, IsMultipleAllowed = true, InstancePropertyTypeId = null }, new PropertyType { Id = 3, IsRichText = true, IsMultipleAllowed = true, InstancePropertyTypeId = 102 }, new PropertyType { Id = 4, IsRichText = true, IsMultipleAllowed = true, InstancePropertyTypeId = null }, new PropertyType { Id = 5, IsRichText = false, IsMultipleAllowed = true, InstancePropertyTypeId = 103 }, new PropertyType { Id = 6, IsRichText = true, IsMultipleAllowed = true, InstancePropertyTypeId = null }, new PropertyType { Id = 7, IsRichText = true, IsMultipleAllowed = true, InstancePropertyTypeId = 104 }, new PropertyType { Id = 8, IsRichText = false, IsMultipleAllowed = true, InstancePropertyTypeId = null }, new PropertyType { Id = 9, IsRichText = false, IsMultipleAllowed = true, InstancePropertyTypeId = 105 }, new PropertyType { Id = 10, IsRichText = false, IsMultipleAllowed = true, InstancePropertyTypeId = null }, new PropertyType { Id = 11, IsRichText = true, IsMultipleAllowed = true, InstancePropertyTypeId = 106 }, new PropertyType { Id = 12, IsRichText = true, IsMultipleAllowed = true, InstancePropertyTypeId = null }, new PropertyType { Id = 13, InstancePropertyTypeId = null }, new PropertyType { Id = 14, InstancePropertyTypeId = 107 }, new PropertyType { Id = 15, InstancePropertyTypeId = 108 }, new PropertyType { Id = 16, InstancePropertyTypeId = 109 }, new PropertyType { Id = 17, InstancePropertyTypeId = null }, new PropertyType { Id = 18, InstancePropertyTypeId = null }, new PropertyType { Id = 19, InstancePropertyTypeId = 110 }, new PropertyType { Id = 20, InstancePropertyTypeId = null } }; var propertyTypeIds = new List <int> { 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; // Act var actualOrder = SqlProjectMetaRepository.OrderProperties(propertyTypeIds, propertyTypes, advancedSettings); // Assert CollectionAssert.AreEqual(expectedOrder, actualOrder); }