コード例 #1
0
        /// <summary>
        ///   Stores the specified entity.
        /// </summary>
        /// <param name = "feature">The entity to be stored.</param>
        /// <returns>The entity that was saved.</returns>
        public Feature Store(Feature feature)
        {
            FeatureKey featureKey = FeatureKey.Create(feature.Id, feature.OwnerId, feature.Space);

            m_FeatureList.AddOrUpdate(featureKey, key => feature, (key, original) => feature);
            return(feature);
        }
コード例 #2
0
        public void UpdateFeatureStateExceptionThrownWhenUpdatingNonExistentFeature()
        {
            string                    messageId            = Guid.NewGuid().ToString();
            Guid                      space                = Guid.NewGuid();
            Guid                      owner                = Guid.NewGuid();
            FeatureKey                featureQuery         = FeatureKey.Create(1, owner, space);
            StandardFeatureStore      standardFeatureStore = new StandardFeatureStore(m_StorageContainer);
            UpdateFeatureStateRequest request              = UpdateFeatureStateRequest.Create(messageId, featureQuery, true);

            using (m_MockRepository.Record())
            {
                Expect.Call(m_StorageContainer.Retrieve(featureQuery)).Return(null);
                m_MockRepository.ReplayAll();

                try
                {
                    standardFeatureStore.UpdateFeatureState(request);
                    Assert.Fail("Expected a UpdateFeatureStateException to be thrown");
                }
                catch (UpdateFeatureStateException ex)
                {
                    StringAssert.Contains(ex.Message, "Id 1");
                    StringAssert.Contains(ex.Message, "Space " + space);
                    Assert.IsNotNull(ex.InnerException);
                }
            }
        }
コード例 #3
0
        public void CreateFeatureThrowsFeatureStoreFaultExceptionOnException()
        {
            IStorageContainer storageContainer = m_MockRepository.StrictMock <IStorageContainer>();
            Feature           feature          = Feature.Create(1, Guid.NewGuid(), Guid.NewGuid(),
                                                                "CreateFeatureThrowsCreateFeatureFaultOnException");

            using (m_MockRepository.Record())
            {
                Expect.Call(storageContainer.Retrieve(FeatureKey.Create(feature.Id, feature.OwnerId, feature.Space))).
                Throw(new CreateFeatureException("Bad Mojo Exception"));
                m_MockRepository.ReplayAll();

                FeatureStoreService featureStoreService = new FeatureStoreService(storageContainer);

                try
                {
                    featureStoreService.CreateFeature(
                        CreateFeatureRequest.Create(
                            "CreateFeatureThrowsCreateFeatureFaultOnException",
                            feature));

                    Assert.Fail("Expecting FaultException<FeatureStoreFault>");
                }
                catch (FaultException <FeatureStoreFault> e)
                {
                    Console.WriteLine(e.Detail.Message);
                    Console.WriteLine(e.Message);
                    StringAssert.Contains(e.Detail.Message, "Bad Mojo Exception");
                }

                m_MockRepository.VerifyAll();
            }
        }
コード例 #4
0
        public void CreateFeatureFailsWhenDuplicateKeyProvided()
        {
            string  messageId = Guid.NewGuid().ToString();
            Feature toCreate  = Feature.Create(1, Guid.NewGuid(), Guid.NewGuid(), FeatureName);

            IFeatureStore featureStore = new StandardFeatureStore(m_StorageContainer);

            using (m_MockRepository.Record())
            {
                Expect.Call(m_StorageContainer.Retrieve(FeatureKey.Create(toCreate.Id, toCreate.OwnerId, toCreate.Space)))
                .Return(toCreate);
                m_MockRepository.ReplayAll();

                try
                {
                    featureStore.CreateFeature(CreateFeatureRequest.Create(messageId, toCreate));
                    Assert.Fail("Expected FeatureCreationException due to duplicate key violation.");
                }
                catch (CreateFeatureException e)
                {
                    StringAssert.Contains(e.Message, "duplicate key violation");
                    StringAssert.Contains(e.Message, "Id");
                    StringAssert.Contains(e.Message, "OwnerId");
                    StringAssert.Contains(e.Message, "Space");
                }
            }
        }
コード例 #5
0
        public void ExistingFeatureIsUpdatedCorrectly()
        {
            string     messageId      = Guid.NewGuid().ToString();
            Guid       space          = Guid.NewGuid();
            Guid       owner          = Guid.NewGuid();
            FeatureKey featureQuery   = FeatureKey.Create(1, owner, space);
            Feature    storedFeature  = Feature.Create(1, owner, space, FeatureName);
            Feature    updatedFeature = Feature.Create(1, owner, space, FeatureName);

            updatedFeature.Enabled = true;
            StandardFeatureStore      standardFeatureStore = new StandardFeatureStore(m_StorageContainer);
            UpdateFeatureStateRequest request = UpdateFeatureStateRequest.Create(messageId, featureQuery, true);

            using (m_MockRepository.Record())
            {
                Expect.Call(m_StorageContainer.Retrieve(featureQuery)).Return(storedFeature);
                Expect.Call(m_StorageContainer.Store(storedFeature)).Return(updatedFeature);
                m_MockRepository.ReplayAll();

                UpdateFeatureStateResponse response = standardFeatureStore.UpdateFeatureState(request);

                Assert.AreEqual(messageId, response.Header.MessageId);
                Assert.AreEqual(1, response.Result.Id);
                Assert.AreEqual(space, response.Result.Space);
                Assert.IsTrue(response.Result.Enabled);

                m_MockRepository.VerifyAll();
            }
        }
コード例 #6
0
        public void CreateFeature()
        {
            Feature toCreate = Feature.Create(1, Guid.NewGuid(), Guid.NewGuid(), FeatureName);

            IStorageContainer container = m_MockRepository.StrictMock <IStorageContainer>();
            string            messageId = Guid.NewGuid().ToString();

            using (m_MockRepository.Record())
            {
                Expect.Call(container.Retrieve(FeatureKey.Create(toCreate.Id, toCreate.OwnerId, toCreate.Space))).Return
                    (null);
                Expect.Call(container.Store(toCreate)).Return(toCreate);
                m_MockRepository.ReplayAll();

                StandardFeatureStore service = new StandardFeatureStore(container);

                CreateFeatureRequest request = CreateFeatureRequest.Create(messageId, toCreate);

                CreateFeatureResponse response = service.CreateFeature(request);

                Assert.AreEqual(messageId, response.Header.MessageId);
                Assert.AreEqual(toCreate.Id, response.Result.Id);
                Assert.AreEqual(toCreate.Name, response.Result.Name);
                Assert.AreEqual(toCreate.Space, response.Result.Space);
                Assert.AreEqual(toCreate.OwnerId, response.Result.OwnerId);

                m_MockRepository.VerifyAll();
            }
        }
コード例 #7
0
        public void CreateFeatureExceptionThrownWhenCreationFails()
        {
            string    messageId = Guid.NewGuid().ToString();
            Exception exception = m_MockRepository.StrictMock <Exception>();

            Feature toCreate             = Feature.Create(1, Guid.NewGuid(), Guid.NewGuid(), FeatureName);
            CreateFeatureRequest request = CreateFeatureRequest.Create(messageId, toCreate);

            IFeatureStore featureStore = new StandardFeatureStore(m_StorageContainer);

            using (m_MockRepository.Record())
            {
                Expect.Call(exception.Message).Return("Bad Mojo");
                Expect.Call(m_StorageContainer.Retrieve(FeatureKey.Create(toCreate.Id, toCreate.OwnerId, toCreate.Space)))
                .Return(null);
                Expect.Call(m_StorageContainer.Store(toCreate)).Throw(exception);
                m_MockRepository.ReplayAll();

                try
                {
                    featureStore.CreateFeature(request);
                    Assert.Fail("Expected FeatureCreationException");
                }
                catch (CreateFeatureException)
                {
                }

                m_MockRepository.VerifyAll();
            }
        }
コード例 #8
0
        public void CheckFeatureStateThrowsFeatureStoreFaultExceptionOnException()
        {
            IStorageContainer storageContainer = m_MockRepository.StrictMock <IStorageContainer>();
            FeatureKey        key = FeatureKey.Create(1, Guid.NewGuid(), Guid.NewGuid());

            using (m_MockRepository.Record())
            {
                Expect.Call(storageContainer.Retrieve(FeatureKey.Create(key.Id, key.OwnerId, key.Space))).Throw(
                    new CheckFeatureStateException("Bad Mojo Exception"));
                m_MockRepository.ReplayAll();

                FeatureStoreService featureStoreService = new FeatureStoreService(storageContainer);

                try
                {
                    featureStoreService.CheckFeatureState(
                        CheckFeatureStateRequest.Create(
                            "CheckFeatureStateThrowsFeatureStoreFaultExceptionOnException",
                            key));

                    Assert.Fail("Expecting FaultException<FeatureStoreFault>");
                }
                catch (FaultException <FeatureStoreFault> e)
                {
                    Console.WriteLine(e.Detail.Message);
                    Console.WriteLine(e.Message);
                    StringAssert.Contains(e.Detail.Message,
                                          "An exception occurred querying the data store for the Feature.");
                }

                m_MockRepository.VerifyAll();
            }
        }
コード例 #9
0
        public void ExceptionIsRaisedAsCheckFeatureStateException()
        {
            string     messageId             = Guid.NewGuid().ToString();
            Exception  exception             = m_MockRepository.StrictMock <Exception>();
            FeatureKey query                 = FeatureKey.Create(-1, Guid.Empty, Guid.Empty);
            CheckFeatureStateRequest request = CheckFeatureStateRequest.Create(messageId, query);
            StandardFeatureStore     standardFeatureStore = new StandardFeatureStore(m_StorageContainer);

            using (m_MockRepository.Record())
            {
                Expect.Call(exception.Message).Return("Bad Mojo");
                Expect.Call(m_StorageContainer.Retrieve(query)).Throw(exception);
                m_MockRepository.ReplayAll();

                try
                {
                    standardFeatureStore.CheckFeatureState(request);
                    Assert.Fail("Expected CheckFeatureStateException");
                }
                catch (CheckFeatureStateException e)
                {
                    StringAssert.Contains(e.Message, "Id " + query.Id);
                    StringAssert.Contains(e.Message, "Space " + query.Space);
                }

                m_MockRepository.VerifyAll();
            }
        }
コード例 #10
0
 private static FeatureKey BuildFeatureKey(string line)
 {
     string[] parts = line.Split(' ');
     return(FeatureKey.Create(
                long.Parse(parts[0]),
                new Guid(parts[2]), new Guid(parts[1])));
 }
コード例 #11
0
 /// <summary>
 ///   Builds the feature key.
 /// </summary>
 /// <param name = "serviceMethodUiBridge">The service method UI bridge.</param>
 /// <returns></returns>
 protected FeatureKey BuildFeatureKey(IServiceMethodUiBridge serviceMethodUiBridge)
 {
     return(FeatureKey.Create(
                serviceMethodUiBridge.FeatureStoreMethodArguments.Id,
                serviceMethodUiBridge.FeatureStoreMethodArguments.OwnerId,
                serviceMethodUiBridge.FeatureStoreMethodArguments.Space));
 }
コード例 #12
0
        private static CheckFeatureStateRequest BuildCheckFeatureStateRequestWithSavedFeature(string messageId)
        {
            Feature feature = Feature.Create(1, Guid.NewGuid(), Guid.NewGuid(), "CheckFeatureStateFeature");

            AddFeatureToStorage(messageId, feature);
            return(CheckFeatureStateRequest.Create(messageId,
                                                   FeatureKey.Create(feature.Id, feature.OwnerId, feature.Space)));
        }
コード例 #13
0
 /// <summary>
 ///   Builds the feature key rich text.
 /// </summary>
 /// <param name = "featureKey">The feature key.</param>
 /// <returns></returns>
 protected static string BuildFeatureKeyRichText(FeatureKey featureKey)
 {
     return(string.Format(
                CultureInfo.CurrentUICulture,
                RtfResources.FEATURE_KEY_FORMAT,
                featureKey.Id,
                featureKey.OwnerId,
                featureKey.Space));
 }
コード例 #14
0
        /// <summary>
        ///   Searches for a <see cref = "Feature" /> matching the criteria specified in the query.
        /// </summary>
        /// <param name = "key">The query.</param>
        /// <returns>
        ///   A <see cref = "Feature" /> instance matching the parameters specified by the <see cref = "FeatureKey" /> or null.
        /// </returns>
        public Feature Retrieve(FeatureKey key)
        {
            if (m_ActiveFeatureList.ContainsKey(key))
            {
                return(m_ActiveFeatureList[key]);
            }

            return(null);
        }
コード例 #15
0
        private static UpdateFeatureStateRequest BuildUpdateFeatureStateRequestWithSavedFeature(string messageId)
        {
            Feature feature = Feature.Create(2, Guid.NewGuid(), Guid.NewGuid(), "UpdateFeatureStateFeature");

            AddFeatureToStorage(messageId, feature);
            return(UpdateFeatureStateRequest.Create(
                       messageId,
                       FeatureKey.Create(feature.Id, feature.OwnerId, feature.Space),
                       !feature.Enabled));
        }
コード例 #16
0
 /// <summary>
 ///   Checks the duplicate key.
 /// </summary>
 /// <param name = "feature">The feature.</param>
 private void CheckDuplicateKey(Feature feature)
 {
     if (m_StorageContainer.Retrieve(FeatureKey.Create(feature.Id, feature.OwnerId, feature.Space)) != null)
     {
         throw new CreateFeatureException(
                   string.Format(
                       CultureInfo.CurrentUICulture,
                       ExceptionMessageResources.DUPLICATE_KEY_VIOLATION,
                       feature.Id,
                       feature.OwnerId,
                       feature.Space));
     }
 }
コード例 #17
0
        private FeatureCover getMatchingCover(string question, FeatureKey key)
        {
            var parsedQuestion = UtteranceParser.Parse(question);

            foreach (var cover in FeatureCover.GetFeatureCovers(parsedQuestion, Graph))
            {
                if (key.Equals(cover.FeatureKey))
                {
                    return(cover);
                }
            }

            return(null);
        }
コード例 #18
0
        public void ExistingFeatureStorageFileIsLoaded()
        {
            CacheSwappingStorageContainer container = new CacheSwappingStorageContainer(@"features.dat");
            Feature feature =
                container.Retrieve(
                    FeatureKey.Create(
                        5,
                        new Guid("a7fd39ea-95a1-48d3-9c5e-0aee8045f3f7"),
                        new Guid("275f5020-b4ec-4f6c-90d7-798999c8d932")));

            Assert.IsNotNull(feature);
            Assert.AreEqual("Feature 5", feature.Name);
            Assert.IsFalse(feature.Enabled);
        }
コード例 #19
0
 private void BuildFeatureStore()
 {
     Console.WriteLine(string.Format(CultureInfo.CurrentUICulture, @">. Building {0} Features.", m_FeatureCount));
     using (new InternalStopWatch("BuildFeatureStore"))
     {
         m_Dictionary = new ConcurrentDictionary <FeatureKey, Feature>();
         for (int index = 0; index < m_FeatureCount; index++)
         {
             Guid space = Guid.NewGuid();
             Guid owner = Guid.NewGuid();
             m_Dictionary.AddOrUpdate(FeatureKey.Create(index, owner, space),
                                      Feature.Create(index, owner, space, "Feature " + index),
                                      (k, f) => f);
         }
     }
 }
コード例 #20
0
        public void Execute(IServiceMethodUiBridge serviceMethodUiBridge)
        {
            FeatureKey featureKey = BuildFeatureKey(serviceMethodUiBridge);

            try
            {
                CheckFeatureStateRequest request = CheckFeatureStateRequest.Create(
                    MessageIdFactory.GenerateMessageId(), featureKey);
                IFeatureStoreServiceProxy featureStoreServiceProxy = new FeatureStoreServiceProxy();
                CheckFeatureStateResponse response = featureStoreServiceProxy.CheckFeatureState(request);

                serviceMethodUiBridge.DisplayResults(BuildResultsRichText(request, response, GetType().Name));
            }
            catch (Exception e)
            {
                serviceMethodUiBridge.DisplayResults(BuildExceptionRichText(e));
            }
        }
コード例 #21
0
        public void Execute(IServiceMethodUiBridge serviceMethodUiBridge)
        {
            m_ServiceMethodUiBridge = serviceMethodUiBridge;
            AsyncOperation asyncOperation = AsyncOperationManager.CreateOperation(m_AsyncKey);

            try
            {
                FeatureKey featureKey = BuildFeatureKey(serviceMethodUiBridge);

                UpdateFeatureStateRequest request = UpdateFeatureStateRequest.Create(
                    MessageIdFactory.GenerateMessageId(),
                    featureKey,
                    serviceMethodUiBridge.FeatureStoreMethodArguments.State);

                IFeatureStoreServiceProxy featureStoreServiceProxy = new FeatureStoreServiceProxy();

                featureStoreServiceProxy.BeginUpdateFeatureState(
                    request,
                    ar =>
                {
                    string rtfResults;
                    try
                    {
                        UpdateFeatureStateResponse response =
                            featureStoreServiceProxy.EndUpdateFeatureState(ar);

                        rtfResults = BuildResultsRichText(request, response, GetType().Name);
                    }
                    catch (Exception e)
                    {
                        rtfResults = BuildExceptionRichText(e);
                    }

                    asyncOperation.PostOperationCompleted(HandleEndAsync, rtfResults);
                },
                    null);
            }
            catch (Exception e)
            {
                serviceMethodUiBridge.DisplayResults(BuildExceptionRichText(e));
            }
        }
コード例 #22
0
        public void UpdateFeature()
        {
            Feature feature = Feature.Create(2112, Guid.NewGuid(), Guid.NewGuid(), "To Be Updated");
            Feature stored  = m_StorageContainer.Store(feature);

            Assert.IsFalse(feature.Enabled);
            Assert.IsFalse(stored.Enabled);

            stored.Enabled = true;

            Feature newStored = m_StorageContainer.Store(stored);

            Assert.IsNotNull(newStored);
            Assert.IsTrue(newStored.Enabled);

            Feature retrieved = m_StorageContainer.Retrieve(FeatureKey.Create(stored.Id, stored.OwnerId, stored.Space));

            Assert.IsNotNull(retrieved);
            Assert.IsTrue(retrieved.Enabled);
        }
コード例 #23
0
        public void NonExistentFeatureResultsInNullResult()
        {
            string     messageId             = Guid.NewGuid().ToString();
            FeatureKey query                 = FeatureKey.Create(-1, Guid.Empty, Guid.Empty);
            CheckFeatureStateRequest request = CheckFeatureStateRequest.Create(messageId, query);
            StandardFeatureStore     standardFeatureStore = new StandardFeatureStore(m_StorageContainer);

            using (m_MockRepository.Record())
            {
                Expect.Call(m_StorageContainer.Retrieve(query)).Return(null);

                m_MockRepository.ReplayAll();

                CheckFeatureStateResponse response = standardFeatureStore.CheckFeatureState(request);

                Assert.AreEqual(messageId, response.Header.MessageId);
                Assert.IsNull(response.Result);
                m_MockRepository.VerifyAll();
            }
        }
コード例 #24
0
        /// <summary>
        ///   Stores the specified entity.
        /// </summary>
        /// <param name = "feature">The entity to be stored.</param>
        /// <returns>The entity that was saved.</returns>
        public Feature Store(Feature feature)
        {
            lock (m_SyncRoot)
            {
                FeatureKey featureKey = FeatureKey.Create(feature.Id, feature.OwnerId, feature.Space);

                // update the current backup copy
                m_BackupFeatureList.AddOrUpdate(featureKey, key => feature, (key, original) => feature);

                // persist the new feature set to disk
                SerializeCache(m_BackupFeatureList);

                // swap the backup into the active
                m_BackupFeatureList = Interlocked.Exchange(ref m_ActiveFeatureList, m_BackupFeatureList);

                // update the previously active copy
                m_BackupFeatureList.AddOrUpdate(featureKey, key => feature, (key, original) => feature);
            }

            return(feature);
        }
コード例 #25
0
        private void ProfileRetrieve()
        {
            Stopwatch stopwatch  = new Stopwatch();
            long      acc        = 0;
            long      min        = 0;
            long      max        = 0;
            long      lineNumber = 0;

            using (new InternalStopWatch("ProfileRetrieve"))
            {
                using (StreamReader streamReader = File.OpenText(m_SampleKeysFilename))
                {
                    string line = streamReader.ReadLine();
                    while (!string.IsNullOrEmpty(line))
                    {
                        lineNumber++;

                        FeatureKey key = BuildFeatureKey(line);

                        stopwatch.Start();
                        Feature feature = m_StorageContainer.Retrieve(key);
                        stopwatch.Stop();

                        Debug.Assert(feature != null);

                        long elapsedMilliseconds = stopwatch.ElapsedMilliseconds;

                        min  = lineNumber == 1 ? elapsedMilliseconds : Math.Min(min, elapsedMilliseconds);
                        max  = Math.Max(max, elapsedMilliseconds);
                        acc += elapsedMilliseconds;

                        line = streamReader.ReadLine();
                    }
                }

                Console.WriteLine(@">> Retrieve performance: Min: {0}, Max {1}, Avg {2}", min, max, (acc / lineNumber));
            }
        }
コード例 #26
0
        public void MultipleFeaturesCanBeAddedToStorageAndQueriedIndividually()
        {
            const string featureNameBase = "Feature Name ";
            const int    count           = 5;

            Guid[] spaces = new Guid[count];
            Guid[] owners = new Guid[count];

            for (int index = 0; index < count; index++)
            {
                spaces[index] = Guid.NewGuid();
                owners[index] = Guid.NewGuid();

                Feature feature = Feature.Create(index, owners[index], spaces[index], featureNameBase + index);
                Feature stored  = m_StorageContainer.Store(feature);

                Assert.AreEqual(feature.Id, stored.Id);
                Assert.AreEqual(feature.Space, stored.Space);
                Assert.AreEqual(feature.OwnerId, stored.OwnerId);
                Assert.AreEqual(feature.Name, stored.Name);
                Assert.IsFalse(stored.Enabled);
            }

            for (int index = 0; index < 5; index++)
            {
                Feature retrieved = m_StorageContainer.Retrieve(FeatureKey.Create(index, owners[index], spaces[index]));

                Assert.IsNotNull(retrieved);

                Assert.AreEqual(index, retrieved.Id);
                Assert.AreEqual(spaces[index], retrieved.Space);
                Assert.AreEqual(owners[index], retrieved.OwnerId);
                Assert.AreEqual(featureNameBase + index, retrieved.Name);
                Assert.IsFalse(retrieved.Enabled);
            }

            Assert.IsNull(m_StorageContainer.Retrieve(FeatureKey.Create(2112, Guid.Empty, Guid.Empty)));
        }
コード例 #27
0
        /// <summary>
        ///   Searches for a <see cref = "Feature" /> matching the criteria specified in the query.
        /// </summary>
        /// <param name = "key">The query.</param>
        /// <returns>
        ///   A <see cref = "Feature" /> instance matching the parameters specified by the <see cref = "FeatureKey" /> or null.
        /// </returns>
        public Feature Retrieve(FeatureKey key)
        {
            Feature feature = null;

            using (SqlConnection connection = CreateSqlConnection())
            {
                SqlCommand command = connection.CreateCommand();
                command.CommandText = "[FeatureStore].[RetrieveOne]";
                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@Id", key.Id);
                command.Parameters.AddWithValue("@OwnerUid", key.OwnerId);
                command.Parameters.AddWithValue("@SpaceUid", key.Space);

                connection.Open();

                using (SqlDataReader reader = command.ExecuteReader())
                {
                    if (reader.Read())
                    {
                        long   id    = long.Parse(reader[0].ToString(), CultureInfo.CurrentCulture);
                        Guid   owner = new Guid(reader[1].ToString());
                        Guid   space = new Guid(reader[2].ToString());
                        string name  = reader.GetString(3);

                        feature = Feature.Create(
                            id,
                            owner,
                            space,
                            name);

                        feature.Enabled = reader.GetBoolean(4);
                    }
                }
            }

            return(feature);
        }
コード例 #28
0
        public void QueryExistingFeature()
        {
            string     messageId                      = Guid.NewGuid().ToString();
            Guid       space                          = Guid.NewGuid();
            Guid       owner                          = Guid.NewGuid();
            FeatureKey query                          = FeatureKey.Create(1, owner, space);
            CheckFeatureStateRequest request          = CheckFeatureStateRequest.Create(messageId, query);
            Feature foundFeature                      = Feature.Create(1, owner, space, FeatureName);
            StandardFeatureStore standardFeatureStore = new StandardFeatureStore(m_StorageContainer);

            using (m_MockRepository.Record())
            {
                Expect.Call(m_StorageContainer.Retrieve(query)).Return(foundFeature);

                m_MockRepository.ReplayAll();

                CheckFeatureStateResponse response = standardFeatureStore.CheckFeatureState(request);

                Assert.AreEqual(messageId, response.Header.MessageId);
                Assert.IsNotNull(response);
                Assert.IsFalse(response.Result.Enabled);
                m_MockRepository.VerifyAll();
            }
        }
コード例 #29
0
ファイル: Program.cs プロジェクト: ciroque/feature-store
        /// <summary>
        /// Generates a <see cref="FeatureKey"/> from the <see cref="Feature"/> at the given index.
        /// </summary>
        /// <param name="index">
        /// The index.
        /// </param>
        /// <returns>
        /// An initialized <see cref="FeatureKey"/>.
        /// </returns>
        private FeatureKey CreateFeatureKey(int index)
        {
            Feature feature = m_StandardFeatures[index];

            return(FeatureKey.Create(feature.Id, feature.OwnerId, feature.Space));
        }
コード例 #30
0
 internal FeatureEvidence(FeatureCover cover, ComposedGraph graph)
 {
     Graph                = graph;
     FeatureKey           = cover.FeatureKey;
     _generalFeatureNodes = cover.GetGeneralNodes(graph).ToArray();
 }