//[ExpectedException(typeof(WebFaultException<ErrorDetail>), "Wildcard was not configured for AspenPlus")]
        public void TestSimulationUpdate_AspenPlus_NoAny()
        {
            Mock <IWebOperationContext> mockContext = new Mock <IWebOperationContext> {
                DefaultValue = DefaultValue.Mock
            };
            var simulationName = "RandomName4";

            Debug.WriteLine("Test");
            ISimulationResource iSimulation = new MockSimulationResource();

            iSimulation.UpdateSimulation(simulationName, new Turbine.Data.Serialize.Simulation {
                Application = "AspenPlus", Name = simulationName
            });

            using (new MockedWebOperationContext(mockContext.Object))
            {
                var sizeInBytes = 500;
                using (MemoryStream stream = new MemoryStream())
                {
                    using (BinaryWriter writer = new BinaryWriter(stream))
                    {
                        while (writer.BaseStream.Length <= sizeInBytes)
                        {
                            writer.Write("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
                        }
                        Debug.WriteLine("LENGTH: " + writer.BaseStream.Length);
                        iSimulation.UpdateStagedInputFile(simulationName, "librarytest.dll", stream);
                        writer.Close();
                    }
                }
            }
        }
        public void TestSimulationUpdate_50MB()
        {
            Mock <IWebOperationContext> mockContext = new Mock <IWebOperationContext> {
                DefaultValue = DefaultValue.Mock
            };
            var simulationName = Guid.NewGuid().ToString();

            Debug.WriteLine("Test");
            ISimulationResource iSimulation = new MockSimulationResource();

            iSimulation.UpdateSimulation(simulationName, new Turbine.Data.Serialize.Simulation {
                Application = "ACM", Name = simulationName
            });

            using (new MockedWebOperationContext(mockContext.Object))
            {
                var sizeInBytes = 50 * 1048576;
                using (MemoryStream stream = new MemoryStream())
                {
                    using (BinaryWriter writer = new BinaryWriter(stream))
                    {
                        while (writer.BaseStream.Length <= sizeInBytes)
                        {
                            writer.Write("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
                        }
                        Debug.WriteLine("LENGTH: " + writer.BaseStream.Length);
                        iSimulation.UpdateStagedInputFile(simulationName, "aspenfile", stream);
                        writer.Close();
                    }
                }
            }
        }
        public void TestSimulationUpdate()
        {
            Mock <IWebOperationContext> mockContext = new Mock <IWebOperationContext> {
                DefaultValue = DefaultValue.Mock
            };
            var simulationName = "RandomName1";

            Debug.WriteLine("Test");
            ISimulationResource iSimulation = new MockSimulationResource();

            iSimulation.UpdateSimulation(simulationName, new Turbine.Data.Serialize.Simulation {
                Application = "ACM", Name = simulationName
            });
            using (new MockedWebOperationContext(mockContext.Object))
            {
                using (var fstream = File.Open(@"models\Hybrid_v0.51_rev1.1_UQ_0809_sinter.json", FileMode.Open))
                {
                    iSimulation.UpdateStagedInputFile(simulationName, "configuration", fstream);
                }
            }
            //mockContext.VerifySet(c => c.OutgoingResponse.ContentType, "application/atom+xml");
            using (new MockedWebOperationContext(mockContext.Object))
            {
                using (var fstream = File.Open(@"models\Hybrid_v0.51_rev1.1_UQ_0809.acmf", FileMode.Open))
                {
                    iSimulation.UpdateStagedInputFile(simulationName, "aspenfile", fstream);
                }
            }
            //mockContext.VerifySet(c => c.OutgoingResponse.ContentType, "application/atom+xml");

            using (new MockedWebOperationContext(mockContext.Object))
            {
                using (var fstream = File.Open(@"models\Hybrid_v0.51_rev1.1_UQ_0809_sinter.json", FileMode.Open))
                {
                    iSimulation.UpdateStagedInputFile(simulationName, "configuration", fstream);
                }
            }

            var mySimulation = iSimulation.GetSimulation(simulationName);

            Assert.AreEqual(mySimulation.Application, "ACM");
            Assert.AreEqual(mySimulation.Name, simulationName);
            Assert.AreEqual(mySimulation.StagedInputs.Count, 2);
        }
        public void TestSimulationUpdate_ACM_Directory_Any()
        {
            Mock <IWebOperationContext> mockContext = new Mock <IWebOperationContext> {
                DefaultValue = DefaultValue.Mock
            };
            var simulationName = "RandomName2";

            Debug.WriteLine("Test");
            ISimulationResource iSimulation = new MockSimulationResource();

            iSimulation.UpdateSimulation(simulationName, new Turbine.Data.Serialize.Simulation {
                Application = "ACM", Name = simulationName
            });

            using (new MockedWebOperationContext(mockContext.Object))
            {
                var sizeInBytes = 500;
                using (MemoryStream stream = new MemoryStream())
                {
                    using (BinaryWriter writer = new BinaryWriter(stream))
                    {
                        while (writer.BaseStream.Length <= sizeInBytes)
                        {
                            writer.Write("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
                        }
                        Debug.WriteLine("LENGTH: " + writer.BaseStream.Length);
                        iSimulation.UpdateStagedInputFile(simulationName, "var/librarytest.dll", stream);
                        writer.Close();
                    }
                }
            }
            var mySimulation = iSimulation.GetSimulation(simulationName);

            Assert.AreEqual(mySimulation.Application, "ACM");
            Assert.AreEqual(mySimulation.Name, simulationName);
            Assert.AreEqual(mySimulation.StagedInputs.Count, 3);
        }