当前位置: 首页>>代码示例>>C#>>正文


C# TestEnvironmentRespository.Save方法代码示例

本文整理汇总了C#中Dev2.Core.Tests.Environments.TestEnvironmentRespository.Save方法的典型用法代码示例。如果您正苦于以下问题:C# TestEnvironmentRespository.Save方法的具体用法?C# TestEnvironmentRespository.Save怎么用?C# TestEnvironmentRespository.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dev2.Core.Tests.Environments.TestEnvironmentRespository的用法示例。


在下文中一共展示了TestEnvironmentRespository.Save方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EnvironmentRepositorySaveWithSingleNullExpectedDoesNothing

        public void EnvironmentRepositorySaveWithSingleNullExpectedDoesNothing()
        {
            var source = new Mock<IEnvironmentModel>();

            var repo = new TestEnvironmentRespository(source.Object);
            var startCount = repo.All().Count;

            repo.Save((ICollection<IEnvironmentModel>)null);
            Assert.AreEqual(startCount, repo.All().Count);
            Assert.AreEqual(0, repo.AddInternalHitCount);
            Assert.AreEqual(0, repo.WriteSessionHitCount);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:12,代码来源:EnviromentRepositoryTest.cs

示例2: EnvironmentRepository_Fetch_NotFound_ReturnsEnvironment

 public void EnvironmentRepository_Fetch_NotFound_ReturnsEnvironment()
 {
     //------------Setup for test--------------------------
     var c1 = CreateMockConnection();
     var e1 = new EnvironmentModel(Guid.NewGuid(), c1.Object);
     var source = new Mock<IEnvironmentModel>();
     var repo = new TestEnvironmentRespository(source.Object);
     repo.Save(e1);
     //------------Execute Test---------------------------
     var environmentModel = repo.Fetch(new Mock<IEnvironmentModel>().Object);
     //------------Assert Results-------------------------
     Assert.IsNotNull(environmentModel);
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:13,代码来源:EnviromentRepositoryTest.cs

示例3: EnvironmentRepositorySaveWithSingleItemExpectedAddsItem

        public void EnvironmentRepositorySaveWithSingleItemExpectedAddsItem()
        {
            var source = new Mock<IEnvironmentModel>();
            var e1 = new Mock<IEnvironmentModel>();

            var repo = new TestEnvironmentRespository(source.Object);
            var startCount = repo.All().Count;

            repo.Save(e1.Object);
            Assert.AreEqual(startCount + 1, repo.All().Count);
            Assert.AreEqual(1, repo.AddInternalHitCount);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:12,代码来源:EnviromentRepositoryTest.cs

示例4: EnvironmentRepositorySaveWithSingleItemExpectedDoesNotInvokesWriteSession

        public void EnvironmentRepositorySaveWithSingleItemExpectedDoesNotInvokesWriteSession()
        {
            var source = new Mock<IEnvironmentModel>();
            var e1 = new Mock<IEnvironmentModel>();

            var repo = new TestEnvironmentRespository(source.Object);

            repo.Save(e1.Object);
            Assert.AreEqual(0, repo.WriteSessionHitCount);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:10,代码来源:EnviromentRepositoryTest.cs

示例5: EnvironmentRepositorySaveWithSingleExistingItemExpectedReplacesItem

        public void EnvironmentRepositorySaveWithSingleExistingItemExpectedReplacesItem()
        {
            // DO NOT use mock as test requires IEquatable of IEnvironmentModel
            var c1 = CreateMockConnection();
            //var wizard = new Mock<IWizardEngine>();
            var e1 = new EnvironmentModel(Guid.NewGuid(), c1.Object);

            var source = new Mock<IEnvironmentModel>();
            var repo = new TestEnvironmentRespository(source.Object, e1);
            var startCount = repo.All().Count;

            repo.Save(e1);

            Assert.AreEqual(startCount, repo.All().Count);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:15,代码来源:EnviromentRepositoryTest.cs

示例6: EnvironmentRepositorySaveWithSingleExpectedDoesNotConnect

        public void EnvironmentRepositorySaveWithSingleExpectedDoesNotConnect()
        {
            // DO NOT use mock as test requires IEquatable of IEnvironmentModel
            var c1 = CreateMockConnection();
            c1.Setup(c => c.Connect(It.IsAny<Guid>())).Verifiable();

            //var wizard = new Mock<IWizardEngine>();
            var e1 = new EnvironmentModel(Guid.NewGuid(), c1.Object);

            var source = new Mock<IEnvironmentModel>();
            var repo = new TestEnvironmentRespository(source.Object);

            repo.Save(e1);

            c1.Verify(c => c.Connect(It.IsAny<Guid>()), Times.Never());
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:16,代码来源:EnviromentRepositoryTest.cs

示例7: EnvironmentRepositorySaveWithManyItemsExpectedAddsItems

        public void EnvironmentRepositorySaveWithManyItemsExpectedAddsItems()
        {
            var source = new Mock<IEnvironmentModel>();
            var e1 = new Mock<IEnvironmentModel>();
            var e2 = new Mock<IEnvironmentModel>();

            var repo = new TestEnvironmentRespository(source.Object);
            var startCount = repo.All().Count;

            repo.Save(new List<IEnvironmentModel> { e1.Object, e2.Object });
            Assert.AreEqual(startCount + 2, repo.All().Count);
            Assert.AreEqual(2, repo.AddInternalHitCount);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:13,代码来源:EnviromentRepositoryTest.cs

示例8: EnvironmentRepository_Save_ValidEnvironmentModel_ReturnsNotSaveMessage

 public void EnvironmentRepository_Save_ValidEnvironmentModel_ReturnsNotSaveMessage()
 {
     var source = new Mock<IEnvironmentModel>();
     var repo = new TestEnvironmentRespository(source.Object);
     IEnvironmentModel e1 = null;
     // ReSharper disable ExpressionIsAlwaysNull
     var result = repo.Save(e1);
     // ReSharper restore ExpressionIsAlwaysNull
     Assert.AreEqual(result, "Not Saved");
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:10,代码来源:EnviromentRepositoryTest.cs

示例9: EnvironmentRepository_Save_ValidEnvironmentModel_ReturnsASaveMessage

        public void EnvironmentRepository_Save_ValidEnvironmentModel_ReturnsASaveMessage()
        {
            var source = new Mock<IEnvironmentModel>();
            var e1 = new Mock<IEnvironmentModel>();

            var repo = new TestEnvironmentRespository(source.Object);

            var result = repo.Save(e1.Object);

            Assert.AreEqual(result, "Saved");
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:11,代码来源:EnviromentRepositoryTest.cs

示例10: EnvironmentRepository_Save_RaisesItemAddedEvent

 public void EnvironmentRepository_Save_RaisesItemAddedEvent()
 {
     //------------Setup for test--------------------------
     var c1 = CreateMockConnection();
     var e1 = new EnvironmentModel(Guid.NewGuid(), c1.Object);
     var source = new Mock<IEnvironmentModel>();
     bool _eventFired = false;
     var repo = new TestEnvironmentRespository(source.Object);
     repo.ItemAdded += (sender, args) =>
     {
         _eventFired = true;
     };
     e1.Name = "New Name";
     //------------Execute Test---------------------------
     repo.Save(e1);
     //------------Assert Results-------------------------
     Assert.IsTrue(_eventFired);
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:18,代码来源:EnviromentRepositoryTest.cs

示例11: EnvironmentRepository_Save_NotExistingEnvironment_DoesNotRaisesItemEditedEvent

 public void EnvironmentRepository_Save_NotExistingEnvironment_DoesNotRaisesItemEditedEvent()
 {
     //------------Setup for test--------------------------
     var c1 = CreateMockConnection();
     var e1 = new EnvironmentModel(Guid.NewGuid(), c1.Object);
     var source = new Mock<IEnvironmentModel>();
     IEnvironmentModel _editedEnvironment = null;
     var repo = new TestEnvironmentRespository(source.Object);
     repo.ItemEdited += (sender, args) =>
     {
         _editedEnvironment = args.Environment;
     };
     e1.Name = "New Name";
     //------------Execute Test---------------------------
     repo.Save(e1);
     //------------Assert Results-------------------------
     Assert.IsNull(_editedEnvironment);
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:18,代码来源:EnviromentRepositoryTest.cs


注:本文中的Dev2.Core.Tests.Environments.TestEnvironmentRespository.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。