Beispiel #1
0
        public StorageDomainManagerTests()
        {
            string connectionStringEnvVar = Environment.GetEnvironmentVariable(ConnectionStringEnvVar);

            if (!string.IsNullOrEmpty(connectionStringEnvVar))
            {
                this.connectionString = Environment.ExpandEnvironmentVariables(connectionStringEnvVar);
            }

            if (string.IsNullOrWhiteSpace(this.connectionString))
            {
                this.connectionString = "UseDevelopmentStorage=true";
            }

            this.config   = new HttpConfiguration();
            this.settings = new MobileAppSettingsDictionary();
            this.settings.Connections.Add(ConnectionStringName, new ConnectionSettings(ConnectionStringName, this.connectionString));

            var providerMock = new Mock <IMobileAppSettingsProvider>();

            providerMock.Setup(p => p.GetMobileAppSettings()).Returns(this.settings);
            this.config.SetMobileAppSettingsProvider(providerMock.Object);

            this.request = new HttpRequestMessage(HttpMethod.Get, new Uri("http://localhost"));
            this.request.SetConfiguration(this.config);
            this.querySettings = StorageDomainManager <Person> .GetDefaultQuerySettings();

            this.validationSettings = StorageDomainManager <Person> .GetDefaultValidationSettings();

            this.manager = new StorageDomainManagerMock(this);
        }
Beispiel #2
0
        public void GetContinuationToken_ReturnsToken_WhenSpecifiedInRequest()
        {
            HttpRequestMessage     req   = new HttpRequestMessage(HttpMethod.Get, "http://localhost?NextPartitionKey=PartitionKeyValue&NextRowKey=RowKeyValue&NextTableName=TableNameValue");
            TableContinuationToken token = StorageDomainManager <Person> .GetContinuationToken(req);

            Assert.Equal("PartitionKeyValue", token.NextPartitionKey);
            Assert.Equal("RowKeyValue", token.NextRowKey);
            Assert.Equal("TableNameValue", token.NextTableName);

            req   = new HttpRequestMessage(HttpMethod.Get, "http://localhost?NextPartitionKey=PartitionKeyValue&NextRowKey=RowKeyValue");
            token = StorageDomainManager <Person> .GetContinuationToken(req);

            Assert.Equal("PartitionKeyValue", token.NextPartitionKey);
            Assert.Equal("RowKeyValue", token.NextRowKey);
            Assert.Equal(null, token.NextTableName);

            req   = new HttpRequestMessage(HttpMethod.Get, "http://localhost?NextPartitionKey=PartitionKeyValue");
            token = StorageDomainManager <Person> .GetContinuationToken(req);

            Assert.Equal("PartitionKeyValue", token.NextPartitionKey);
            Assert.Equal(null, token.NextRowKey);
            Assert.Equal(null, token.NextTableName);

            req   = new HttpRequestMessage(HttpMethod.Get, "http://localhost?");
            token = StorageDomainManager <Person> .GetContinuationToken(req);

            Assert.Null(token);
        }
Beispiel #3
0
        public void ReplaceDateTimeOffset_Succeeds_WithDateTimeOffsetInFilter(string inputFilter, string outputFilter)
        {
            string actualOutput = StorageDomainManager <Person> .ReplaceDateTimeOffsetWithDateTime(inputFilter);

            Assert.Equal(outputFilter, actualOutput);
        }