Ejemplo n.º 1
1
        public void GenericControlByField()
        {
            PrivateType t = new PrivateType(typeof(GenericFieldControl));
            object obj = t.GetStaticProperty("ControlTable");
            Dictionary<string, Type> qwer = (Dictionary<string, Type>)obj;

            string message;
            Assert.IsTrue(CheckTypes(typeof(ApprovingModeField), typeof(SnControls.DropDown), out message), message);
            Assert.IsTrue(CheckTypes(typeof(BinaryField), typeof(SnControls.Binary), out message), message);
            Assert.IsTrue(CheckTypes(typeof(BooleanField), typeof(SnControls.Boolean), out message), message);
            Assert.IsTrue(CheckTypes(typeof(ChoiceField), typeof(SnControls.DropDown), out message), message);
            Assert.IsTrue(CheckTypes(typeof(ColorField), typeof(SnControls.ShortText), out message), message);
            Assert.IsTrue(CheckTypes(typeof(DateTimeField), typeof(SnControls.DatePicker), out message), message);
            Assert.IsTrue(CheckTypes(typeof(HyperLinkField), typeof(SnControls.HyperLink), out message), message);
            Assert.IsTrue(CheckTypes(typeof(InheritableApprovingModeField), typeof(SnControls.DropDown), out message), message);
            Assert.IsTrue(CheckTypes(typeof(InheritableVersioningModeField), typeof(SnControls.DropDown), out message), message);
            Assert.IsTrue(CheckTypes(typeof(IntegerField), typeof(SnControls.WholeNumber), out message), message);
            Assert.IsTrue(CheckTypes(typeof(LockField), typeof(SnControls.ShortText), out message), message);
            Assert.IsTrue(CheckTypes(typeof(LongTextField), typeof(SnControls.LongText), out message), message);
            Assert.IsTrue(CheckTypes(typeof(NodeTypeField), typeof(SnControls.ShortText), out message), message);
            Assert.IsTrue(CheckTypes(typeof(NumberField), typeof(SnControls.Number), out message), message);
            Assert.IsTrue(CheckTypes(typeof(PasswordField), typeof(SnControls.Password), out message), message);
            Assert.IsTrue(CheckTypes(typeof(ReferenceField), typeof(SnControls.ReferenceGrid), out message), message);
            Assert.IsTrue(CheckTypes(typeof(SecurityField), typeof(SnControls.ShortText), out message), message);
            Assert.IsTrue(CheckTypes(typeof(ShortTextField), typeof(SnControls.ShortText), out message), message);
            //Assert.IsTrue(CheckTypes(typeof(SiteListField), typeof(SnControls.SiteList), out message), message);
            Assert.IsTrue(CheckTypes(typeof(SiteRelativeUrlField), typeof(SnControls.SiteRelativeUrl), out message), message);
            Assert.IsTrue(CheckTypes(typeof(UrlListField), typeof(SnControls.UrlList), out message), message);
            Assert.IsTrue(CheckTypes(typeof(VersioningModeField), typeof(SnControls.DropDown), out message), message);
            Assert.IsTrue(CheckTypes(typeof(WhoAndWhenField), typeof(SnControls.WhoAndWhen), out message), message);
        }
Ejemplo n.º 2
1
 public static StorageContextAccessor Create()
 {
     var x = new PrivateType(typeof(StorageContext));
     var y = (StorageContext)x.GetStaticProperty("Instance");
     return new StorageContextAccessor(y);
 }
Ejemplo n.º 3
0
            public static StorageContextAccessor Create()
            {
                var x = new PrivateType(typeof(StorageContext));
                var y = (StorageContext)x.GetStaticProperty("Instance");

                return(new StorageContextAccessor(y));
            }
        public void EventSourceConsistencyTest()
        {
            var eventSource = new PrivateType("Dealogic.ServiceBus.Azure.Serialization", "Dealogic.ServiceBus.Azure.Serialization.Tracing.ServiceBusSerializationEventSource");
            var log         = (EventSource)eventSource.GetStaticProperty("Log");

            EventSourceAnalyzer.InspectAll(log);
        }
Ejemplo n.º 5
0
        public void TestValidMoves()
        {
            Game game = new Game();

            game.Initialize(MockData.SampleXml);
            game.Bot.SetPosition(1, 2);
            game.Bot.SetPosition(2, 2);
            // Long move
            try
            {
                game.Bot.SetPosition(5, 5);
                Assert.Fail("Xml should fail");
            }
            catch (InvalidMovementException ex)
            {
                PrivateType pt          = new PrivateType("MazeBot", "MazeBot.Resources");
                string      msgExpected = pt.GetStaticProperty("sErrBotMoveCannotMoveNonAdjacentTiles").ToString();
                Assert.AreEqual(msgExpected, ex.Message);
                Assert.IsTrue(game.Bot.Position.X == 2 && game.Bot.Position.Y == 2);
            }

            // Diagonal move
            try
            {
                game.Bot.SetPosition(3, 3);
                Assert.Fail("Xml should fail");
            }
            catch (InvalidMovementException ex)
            {
                PrivateType pt          = new PrivateType("MazeBot", "MazeBot.Resources");
                string      msgExpected = pt.GetStaticProperty("sErrBotMoveCannotMoveNonAdjacentTiles").ToString();
                Assert.AreEqual(msgExpected, ex.Message);
                Assert.IsTrue(game.Bot.Position.X == 2 && game.Bot.Position.Y == 2);
            }

            // Move to wall
            try
            {
                game.Bot.SetPosition(2, 3);
                Assert.Fail("Xml should fail");
            }
            catch (InvalidMovementException ex)
            {
                PrivateType pt          = new PrivateType("MazeBot", "MazeBot.Resources");
                string      msgExpected = pt.GetStaticProperty("sErrBotCannotMoveToWallTile").ToString();
                Assert.AreEqual(msgExpected, ex.Message);
                Assert.IsTrue(game.Bot.Position.X == 2 && game.Bot.Position.Y == 2);
            }
        }
Ejemplo n.º 6
0
        public void UwpAppsAreSupportedTest()
        {
            var accessor     = new PrivateType(typeof(UiAutomationFixture));
            var savedVersion = accessor.GetStaticProperty("PlatformVersion");

            accessor.SetStaticProperty("PlatformVersion", new Version(5, 0, 1000, 10));
            Assert.IsFalse(UiAutomationFixture.UwpAppsAreSupported);
            accessor.SetStaticProperty("PlatformVersion", new Version(6, 1));
            Assert.IsFalse(UiAutomationFixture.UwpAppsAreSupported);
            accessor.SetStaticProperty("PlatformVersion", new Version(6, 2, 9200, 0));
            Assert.IsTrue(UiAutomationFixture.UwpAppsAreSupported);
            accessor.SetStaticProperty("PlatformVersion", new Version(7, 0));
            Assert.IsTrue(UiAutomationFixture.UwpAppsAreSupported);
            accessor.SetStaticProperty("PlatformVersion", savedVersion);
        }
Ejemplo n.º 7
0
        public void BaseMigrationScript()
        {
            var repo          = new PrivateType(typeof(FenixRepositoryScriptExtractor));
            var scripts       = (Dictionary <Type, FenixScript>)repo.GetStaticProperty("Scripts");
            var personScripts = scripts[typeof(Person)];

            var expected =
                @"create table [dbo].[People] (
    [Id] [int] not null identity,
    [FirstName] [nvarchar](128) null,
    [LastName] [nvarchar](128) null,                
    [Age] [int] not null,                 
    [AddressId] [int] not null,              
    [BirthDay] [datetime] not null,
    primary key ([Id])                           
);";

            NormalizedAssertAreEqual(expected, personScripts.TableScript);
            NormalizedAssertAreEqual("alter table [dbo].[People] add constraint [Person_Address] foreign key ([AddressId]) references [dbo].[Addresses]([Id]) on delete cascade;", personScripts.FkScripts.First());

            var expectedIndexes =
                @"CREATE INDEX [IX_Name] ON [dbo].[People]([Name])
CREATE INDEX [IX_Address] ON [dbo].[People]([Address])
DROP INDEX [IX_Name] ON [dbo].[People]
DROP INDEX [IX_Address] ON [dbo].[People]
CREATE INDEX [IX_Names] ON [dbo].[People]([FirstName], [LastName])
CREATE INDEX [IX_AddressId] ON [dbo].[People]([AddressId])
CREATE INDEX [IX_BirthDay] ON [dbo].[People]([BirthDay])";

            NormalizedAssertAreEqual(expectedIndexes, personScripts.IndexScripts.Aggregate((a, b) => $"{a}\r\n{b}"));

            expected =
                @"create table [dbo].[Addresses] (
    [Id] [int] not null identity,
    [PostalCode] [nvarchar](64) null,
    [Street] [nvarchar](64) null,
    [CityId] [int] not null,
    primary key ([Id])
);";
            var addrScripts = scripts[typeof(Context.Models.Address)];

            NormalizedAssertAreEqual(expected, addrScripts.TableScript);

            expectedIndexes =
                @"CREATE INDEX [IX_PostalCode] ON [dbo].[Addresses]([PostalCode])
CREATE INDEX [IX_CityId] ON [dbo].[Addresses]([CityId])";
            NormalizedAssertAreEqual(expectedIndexes, addrScripts.IndexScripts.Aggregate((a, b) => $"{a}\r\n{b}"));
        }
Ejemplo n.º 8
0
        public void StartPointOffLimitsX()
        {
            Game game = new Game();

            try
            {
                game.Initialize(MockData.Invalid_StartPointOffLimitsX);
                Assert.Fail("Xml should fail");
            }
            catch (XmlException ex)
            {
                PrivateType pt          = new PrivateType("MazeBot", "MazeBot.Resources");
                string      msgExpected = pt.GetStaticProperty("sErrXmlStartPointOffLimits").ToString();
                Assert.AreEqual(String.Format(msgExpected, 9, 5), ex.Message);
            }
        }
Ejemplo n.º 9
0
        public void TestGoalPointAtWall()
        {
            Game game = new Game();

            try
            {
                game.Initialize(MockData.Invalid_GoalPointAtWall);
                Assert.Fail("Xml should fail");
            }
            catch (XmlException ex)
            {
                PrivateType pt          = new PrivateType("MazeBot", "MazeBot.Resources");
                string      msgExpected = pt.GetStaticProperty("sErrXmlGoalPointShouldNotBeAtWall").ToString();
                Assert.AreEqual(msgExpected, ex.Message);
            }
        }
Ejemplo n.º 10
0
        public void TestInvalidMazeDimensionY()
        {
            Game game = new Game();

            try
            {
                game.Initialize(MockData.Invalid_InvalidMazeDimensionsY);
                Assert.Fail("Xml should fail");
            }
            catch (XmlException ex)
            {
                PrivateType pt          = new PrivateType("MazeBot", "MazeBot.Resources");
                string      msgExpected = pt.GetStaticProperty("sErrXmlInvalidMazeDimensions").ToString();
                Assert.AreEqual(msgExpected, ex.Message);
            }
        }
Ejemplo n.º 11
0
        public void GlobalApp_OverriddenMethods()
        {
            var app    = new Global();
            var appAcc = new PrivateObject(app);

            //appAcc.Invoke("Application_Start", this, _testArgs);
            appAcc.Invoke("Application_End", this, _testArgs);
            appAcc.Invoke("Application_Error", this, _testArgs);
            appAcc.Invoke("Application_BeginRequest", this, _testArgs);
            appAcc.Invoke("Application_EndRequest", this, _testArgs);

            var snGlobalAcc      = new PrivateType(typeof(Global));
            var snGlobalInstance = snGlobalAcc.GetStaticProperty("Instance") as TestGlobalHttpApp;

            Assert.IsNotNull(snGlobalInstance);

            var log = snGlobalInstance.Log.ToString();

            Assert.IsTrue(log == "Application_End,Application_Error,Application_BeginRequest,Application_EndRequest");
        }
Ejemplo n.º 12
0
        public void User_IdentityChangesWhenNewHostAdded_IdentityChangesAreCorrect()
        {
            // Clear the KnownHostSet.
            PrivateType   privateKnownHostSet = new PrivateType(typeof(KnownHostSet));
            PrivateObject privateInstance     = new PrivateObject(privateKnownHostSet.GetStaticProperty("Instance", null));

            ((HashSet <string>)privateInstance.GetField("knownHosts")).Clear();

            UtilityProgram.Instance.Executable = new FileInfo("MockUtil.exe");
            License testLicense = new License()
            {
                Port = 27001, Host = "LmStatTest"
            };

            // Using GetStatusAsync may be overkill for testing the property changes, but it
            // throws in some threading.
            using (AutoResetEvent waitHandle = new AutoResetEvent(false))
            {
                testLicense.GetStatusCompleted += (s, e) => waitHandle.Set();

                testLicense.GetStatusAsync();

                if (!waitHandle.WaitOne(5100, false))
                {
                    Assert.Fail("Test timed out.");
                }
            }

            Feature testFeature = testLicense.Features.First(f => f.Name == "Users_With_Spaces_ChangedEvent_Other");
            User    target      = testFeature.Users.First();

            Assert.AreEqual(target.Name, "user 504 CAD9695D", "Name property.");
            Assert.AreEqual(target.Host, "display", "Host property.");
            Assert.AreEqual(target.Display, "A504", "Display property.");

            List <string> propertiesChanged = new List <string>();

            target.PropertyChanged += (s, e) => propertiesChanged.Add(e.PropertyName);

            License nxLicense = new License()
            {
                Port = 27000, Host = "LmStatNX"
            };

            using (AutoResetEvent waitHandle = new AutoResetEvent(false))
            {
                nxLicense.GetStatusCompleted += (s, e) => waitHandle.Set();

                nxLicense.GetStatusAsync();

                if (!waitHandle.WaitOne(5100, false))
                {
                    Assert.Fail("Test timed out.");
                }
            }

            Assert.IsTrue(propertiesChanged.Contains("Name"));
            Assert.IsTrue(propertiesChanged.Contains("Host"));
            Assert.IsTrue(propertiesChanged.Contains("Display"));

            Assert.AreEqual(target.Name, "user 504", "Name property.");
            Assert.AreEqual(target.Host, "CAD9695D", "Host property.");
            Assert.AreEqual(target.Display, "display A504", "Display property.");
        }
Ejemplo n.º 13
0
        public void Aspect_OData_AddRemoveFields()
        {
            var aspect = Content.CreateNew("Aspect", Repository.AspectsFolder, Guid.NewGuid().ToString());

            aspect.Save();
            //var aspectPath = aspect.Path;
            var resourcePath = ODataHandler.GetEntityUrl(aspect.Path);

            var content = Content.CreateNew("Car", TestRoot, Guid.NewGuid().ToString());

            content.AddAspects(aspect.Path);
            content.Save();

            var odataHandlerAcc        = new PrivateType(typeof(ODataHandler));
            var originalActionResolver = odataHandlerAcc.GetStaticProperty("ActionResolver");

            odataHandlerAcc.SetStaticProperty("ActionResolver", new ODataTests.TestActionResolver());

            var fieldInfosJson = GetJson(new[] {
                new FieldInfo {
                    Name = "Field1", Type = "ShortText"
                },
                new FieldInfo {
                    Name = "Field2", Type = "ShortText"
                },
                new FieldInfo {
                    Name = "Field3", Type = "ShortText"
                },
            });

            ODataTests.CreateTestSite();
            try
            {
                string result;
                Field  field;

                using (var output = new System.IO.StringWriter())
                {
                    var pc      = ODataTests.CreatePortalContext(string.Concat("/OData.svc", resourcePath, "/AddFields"), "", output);
                    var handler = new ODataHandler();
                    var stream  = ODataTests.CreateRequestStream(String.Concat("{fields:", fieldInfosJson, "}"));
                    handler.ProcessRequest(pc.OwnerHttpContext, "POST", stream);
                    result = output.GetStringBuilder().ToString();
                }
                content = Content.Load(content.Path);
                Assert.IsTrue(content.Fields.TryGetValue(aspect.Name + ".Field1", out field));
                Assert.IsTrue(content.Fields.TryGetValue(aspect.Name + ".Field2", out field));
                Assert.IsTrue(content.Fields.TryGetValue(aspect.Name + ".Field3", out field));
                Assert.IsFalse(content.Fields.TryGetValue(aspect.Name + ".Field4", out field));

                fieldInfosJson = GetJson(new[] {
                    new FieldInfo {
                        Name = "Field4", Type = "ShortText"
                    },
                });

                using (var output = new System.IO.StringWriter())
                {
                    var pc      = ODataTests.CreatePortalContext(string.Concat("/OData.svc", resourcePath, "/AddFields"), "", output);
                    var handler = new ODataHandler();
                    var stream  = ODataTests.CreateRequestStream(String.Concat("{fields:", fieldInfosJson, "}"));
                    handler.ProcessRequest(pc.OwnerHttpContext, "POST", stream);
                    result = output.GetStringBuilder().ToString();
                }
                content = Content.Load(content.Path);
                Assert.IsTrue(content.Fields.TryGetValue(aspect.Name + ".Field1", out field));
                Assert.IsTrue(content.Fields.TryGetValue(aspect.Name + ".Field2", out field));
                Assert.IsTrue(content.Fields.TryGetValue(aspect.Name + ".Field3", out field));
                Assert.IsTrue(content.Fields.TryGetValue(aspect.Name + ".Field4", out field));

                using (var output = new System.IO.StringWriter())
                {
                    var pc      = ODataTests.CreatePortalContext(string.Concat("/OData.svc", resourcePath, "/RemoveFields"), "", output);
                    var handler = new ODataHandler();
                    var stream  = ODataTests.CreateRequestStream(String.Concat("{fields:[\"Field1\"]}"));
                    handler.ProcessRequest(pc.OwnerHttpContext, "POST", stream);
                    result = output.GetStringBuilder().ToString();
                }
                content = Content.Load(content.Path);
                Assert.IsFalse(content.Fields.TryGetValue(aspect.Name + ".Field1", out field));
                Assert.IsTrue(content.Fields.TryGetValue(aspect.Name + ".Field2", out field));
                Assert.IsTrue(content.Fields.TryGetValue(aspect.Name + ".Field3", out field));
                Assert.IsTrue(content.Fields.TryGetValue(aspect.Name + ".Field4", out field));

                using (var output = new System.IO.StringWriter())
                {
                    var pc      = ODataTests.CreatePortalContext(string.Concat("/OData.svc", resourcePath, "/RemoveFields"), "", output);
                    var handler = new ODataHandler();
                    var stream  = ODataTests.CreateRequestStream(String.Concat("{fields:[\"Field4\",\"Field2\"]}"));
                    handler.ProcessRequest(pc.OwnerHttpContext, "POST", stream);
                    result = output.GetStringBuilder().ToString();
                }
                content = Content.Load(content.Path);
                Assert.IsFalse(content.Fields.TryGetValue(aspect.Name + ".Field1", out field));
                Assert.IsFalse(content.Fields.TryGetValue(aspect.Name + ".Field2", out field));
                Assert.IsTrue(content.Fields.TryGetValue(aspect.Name + ".Field3", out field));
                Assert.IsFalse(content.Fields.TryGetValue(aspect.Name + ".Field4", out field));

                using (var output = new System.IO.StringWriter())
                {
                    var pc      = ODataTests.CreatePortalContext(string.Concat("/OData.svc", resourcePath, "/RemoveAllFields"), "", output);
                    var handler = new ODataHandler();
                    handler.ProcessRequest(pc.OwnerHttpContext, "POST", null);
                    result = output.GetStringBuilder().ToString();
                }
                content = Content.Load(content.Path);
                Assert.IsFalse(content.Fields.TryGetValue(aspect.Name + ".Field1", out field));
                Assert.IsFalse(content.Fields.TryGetValue(aspect.Name + ".Field2", out field));
                Assert.IsFalse(content.Fields.TryGetValue(aspect.Name + ".Field3", out field));
                Assert.IsFalse(content.Fields.TryGetValue(aspect.Name + ".Field4", out field));
            }
            finally
            {
                odataHandlerAcc.SetStaticProperty("ActionResolver", originalActionResolver);
                content.DeletePhysical();
                ODataTests.CleanupTestSite();
            }
        }
Ejemplo n.º 14
0
        public void Aspect_OData_AddRemoveAspect()
        {
            var content = Content.CreateNew("Car", TestRoot, Guid.NewGuid().ToString());

            content.Save();
            var resourcePath = ODataHandler.GetEntityUrl(content.Path);
            var aspect1      = Content.CreateNew("Aspect", Repository.AspectsFolder, Guid.NewGuid().ToString());

            aspect1.Save();
            var aspect1Path = aspect1.Path;
            var aspect2     = Content.CreateNew("Aspect", Repository.AspectsFolder, Guid.NewGuid().ToString());

            aspect2.Save();
            var aspect2Path = aspect2.Path;
            var aspect3     = Content.CreateNew("Aspect", Repository.AspectsFolder, Guid.NewGuid().ToString());

            aspect3.Save();
            var aspect3Path = aspect3.Path;

            var odataHandlerAcc        = new PrivateType(typeof(ODataHandler));
            var originalActionResolver = odataHandlerAcc.GetStaticProperty("ActionResolver");

            odataHandlerAcc.SetStaticProperty("ActionResolver", new ODataTests.TestActionResolver());

            ODataTests.CreateTestSite();
            try
            {
                string result;

                using (var output = new System.IO.StringWriter())
                {
                    var pc      = ODataTests.CreatePortalContext(string.Concat("/OData.svc", resourcePath, "/AddAspects"), "", output);
                    var handler = new ODataHandler();
                    var stream  = ODataTests.CreateRequestStream(String.Concat("{aspects:[\"", aspect1Path, "\"]}"));
                    handler.ProcessRequest(pc.OwnerHttpContext, "POST", stream);
                    result = output.GetStringBuilder().ToString();
                }
                content = Content.Load(content.Path);
                Assert.IsTrue(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect1.ContentHandler));
                Assert.IsFalse(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect2.ContentHandler));
                Assert.IsFalse(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect3.ContentHandler));

                using (var output = new System.IO.StringWriter())
                {
                    var pc      = ODataTests.CreatePortalContext(string.Concat("/OData.svc", resourcePath, "/AddAspects"), "", output);
                    var handler = new ODataHandler();
                    var stream  = ODataTests.CreateRequestStream(String.Concat("{aspects:[\"", aspect2Path, "\", \"", aspect3Path, "\"]}"));
                    handler.ProcessRequest(pc.OwnerHttpContext, "POST", stream);
                    result = output.GetStringBuilder().ToString();
                }
                content = Content.Load(content.Path);
                Assert.IsTrue(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect1.ContentHandler));
                Assert.IsTrue(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect2.ContentHandler));
                Assert.IsTrue(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect3.ContentHandler));

                using (var output = new System.IO.StringWriter())
                {
                    var pc      = ODataTests.CreatePortalContext(string.Concat("/OData.svc", resourcePath, "/RemoveAspects"), "", output);
                    var handler = new ODataHandler();
                    var stream  = ODataTests.CreateRequestStream(String.Concat("{aspects:[\"", aspect1Path, "\", \"", aspect3Path, "\"]}"));
                    handler.ProcessRequest(pc.OwnerHttpContext, "POST", stream);
                    result = output.GetStringBuilder().ToString();
                }
                content = Content.Load(content.Path);
                Assert.IsFalse(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect1.ContentHandler));
                Assert.IsTrue(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect2.ContentHandler));
                Assert.IsFalse(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect3.ContentHandler));

                using (var output = new System.IO.StringWriter())
                {
                    var pc      = ODataTests.CreatePortalContext(string.Concat("/OData.svc", resourcePath, "/RemoveAspects"), "", output);
                    var handler = new ODataHandler();
                    var stream  = ODataTests.CreateRequestStream(String.Concat("{aspects:[\"", aspect2Path, "\"]}"));
                    handler.ProcessRequest(pc.OwnerHttpContext, "POST", stream);
                    result = output.GetStringBuilder().ToString();
                }
                content = Content.Load(content.Path);
                Assert.IsFalse(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect1.ContentHandler));
                Assert.IsFalse(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect2.ContentHandler));
                Assert.IsFalse(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect3.ContentHandler));


                content.AddAspects((Aspect)aspect1.ContentHandler, (Aspect)aspect2.ContentHandler, (Aspect)aspect3.ContentHandler);
                content.Save();
                Assert.IsTrue(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect1.ContentHandler));
                Assert.IsTrue(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect2.ContentHandler));
                Assert.IsTrue(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect3.ContentHandler));

                using (var output = new System.IO.StringWriter())
                {
                    var pc      = ODataTests.CreatePortalContext(string.Concat("/OData.svc", resourcePath, "/RemoveAllAspects"), "", output);
                    var handler = new ODataHandler();
                    //var stream = ODataTests.CreateRequestStream(String.Concat("{aspects:[\"", aspect2Path, "\"]}"));
                    handler.ProcessRequest(pc.OwnerHttpContext, "POST", null);
                    result = output.GetStringBuilder().ToString();
                }
                content = Content.Load(content.Path);
                Assert.IsFalse(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect1.ContentHandler));
                Assert.IsFalse(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect2.ContentHandler));
                Assert.IsFalse(((GenericContent)content.ContentHandler).HasReference("Aspects", aspect3.ContentHandler));
            }
            finally
            {
                odataHandlerAcc.SetStaticProperty("ActionResolver", originalActionResolver);
                content.DeletePhysical();
                ODataTests.CleanupTestSite();
            }
        }