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


C# TestEnvironmentRespository.All方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: EnvironmentRepositoryRemoveWithSingleItemExpectedDisconnectsAndRemovesItem

        public void EnvironmentRepositoryRemoveWithSingleItemExpectedDisconnectsAndRemovesItem()
        {
            var source = new Mock<IEnvironmentModel>();
            var c1 = CreateMockConnection();
            var c2 = CreateMockConnection();
            var c3 = CreateMockConnection();

            c1.Setup(c => c.Disconnect()).Verifiable();
            c2.Setup(c => c.Disconnect()).Verifiable();
            c3.Setup(c => c.Disconnect()).Verifiable();

            var e1 = new EnvironmentModel(Guid.NewGuid(), c1.Object, new Mock<IResourceRepository>().Object, new Mock<IStudioResourceRepository>().Object);
            var e2 = new EnvironmentModel(Guid.NewGuid(), c2.Object, new Mock<IResourceRepository>().Object, new Mock<IStudioResourceRepository>().Object);
            var e3 = new EnvironmentModel(Guid.NewGuid(), c3.Object, new Mock<IResourceRepository>().Object, new Mock<IStudioResourceRepository>().Object);

            var repo = new TestEnvironmentRespository(source.Object, e1, e2, e3);

            repo.Remove(e2);
            var actual = repo.All().ToList();

            c1.Verify(c => c.Disconnect(), Times.Never());
            c2.Verify(c => c.Disconnect(), Times.Once());
            c3.Verify(c => c.Disconnect(), Times.Never());

            Assert.AreEqual(3, actual.Count);
            Assert.AreEqual(1, repo.RemoveInternalHitCount);
            Assert.AreSame(source.Object, actual[0]);
            Assert.AreSame(e1, actual[1]);
            Assert.AreSame(e3, actual[2]);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:30,代码来源:EnviromentRepositoryTest.cs

示例6: EnvironmentRepositoryRemoveWithSingleNonExistingItemExpectedDoesNotRemoveItem

        public void EnvironmentRepositoryRemoveWithSingleNonExistingItemExpectedDoesNotRemoveItem()
        {
            var source = new Mock<IEnvironmentModel>();
            var c1 = CreateMockConnection();
            var c2 = CreateMockConnection();
            var c3 = CreateMockConnection();

            var e1 = new EnvironmentModel(Guid.NewGuid(), c1.Object, new Mock<IResourceRepository>().Object, new Mock<IStudioResourceRepository>().Object);
            var e2 = new EnvironmentModel(Guid.NewGuid(), c2.Object, new Mock<IResourceRepository>().Object, new Mock<IStudioResourceRepository>().Object);
            var e3 = new EnvironmentModel(Guid.NewGuid(), c3.Object, new Mock<IResourceRepository>().Object, new Mock<IStudioResourceRepository>().Object);

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

            repo.Remove(e3);

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

示例7: EnvironmentRepositoryRemoveWithManyItemsExpectedDisconnectsAndRemovesItems

        public void EnvironmentRepositoryRemoveWithManyItemsExpectedDisconnectsAndRemovesItems()
        {
            // DO NOT use mock as test requires IEquatable of IEnvironmentModel

            var source = new Mock<IEnvironmentModel>();
            var c1 = CreateMockConnection();
            var c2 = CreateMockConnection();
            var c3 = CreateMockConnection();

            c1.Setup(c => c.Disconnect()).Verifiable();
            c2.Setup(c => c.Disconnect()).Verifiable();
            c3.Setup(c => c.Disconnect()).Verifiable();

            var e1 = new EnvironmentModel(Guid.NewGuid(), c1.Object, new Mock<IResourceRepository>().Object, new Mock<IStudioResourceRepository>().Object);
            var e2 = new EnvironmentModel(Guid.NewGuid(), c2.Object, new Mock<IResourceRepository>().Object, new Mock<IStudioResourceRepository>().Object);
            var e3 = new EnvironmentModel(Guid.NewGuid(), c3.Object, new Mock<IResourceRepository>().Object, new Mock<IStudioResourceRepository>().Object);

            var repo = new TestEnvironmentRespository(source.Object, e1, e2, e3);

            repo.Remove(new List<IEnvironmentModel> { e1, e3 });
            var actual = repo.All().ToList();

            c1.Verify(c => c.Disconnect(), Times.Once());
            c2.Verify(c => c.Disconnect(), Times.Never());
            c3.Verify(c => c.Disconnect(), Times.Once());

            Assert.AreEqual(2, actual.Count);
            Assert.AreEqual(2, repo.RemoveInternalHitCount);
            Assert.AreSame(source.Object, actual[0]);
            Assert.AreSame(e2, actual[1]);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:31,代码来源:EnviromentRepositoryTest.cs

示例8: EnvironmentRepositoryConstructorWithSourceExpectedAddsSource

 public void EnvironmentRepositoryConstructorWithSourceExpectedAddsSource()
 {
     var source = new Mock<IEnvironmentModel>();
     var repo = new TestEnvironmentRespository(source.Object);
     Assert.AreEqual(1, repo.All().Count);
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:6,代码来源:EnviromentRepositoryTest.cs

示例9: EnvironmentRepositoryConstructorWithNoParametersExpectedCreatesAndAddsDefaultSource

 public void EnvironmentRepositoryConstructorWithNoParametersExpectedCreatesAndAddsDefaultSource()
 {
     var repo = new TestEnvironmentRespository();
     var environmentModels = repo.All().ToList();
     Assert.AreEqual(1, environmentModels.Count);
     var localhostEnvironment = environmentModels[0];
     Assert.IsNotNull(localhostEnvironment);
     StringAssert.Contains(localhostEnvironment.DisplayName.ToLower(), Environment.MachineName.ToLower());
 }
开发者ID:Robin--,项目名称:Warewolf,代码行数:9,代码来源:EnviromentRepositoryTest.cs

示例10: EnvironmentRepositoryClearExpectedDisconnectsAndRemovesAllItems

        public void EnvironmentRepositoryClearExpectedDisconnectsAndRemovesAllItems()
        {
            var source = new Mock<IEnvironmentModel>();
            var e1 = new Mock<IEnvironmentModel>();
            e1.Setup(e => e.Disconnect()).Verifiable();
            var e2 = new Mock<IEnvironmentModel>();
            e2.Setup(e => e.Disconnect()).Verifiable();

            var repo = new TestEnvironmentRespository(source.Object, e1.Object, e2.Object);
            Assert.AreEqual(3, repo.All().Count);

            repo.Clear();

            Assert.AreEqual(0, repo.All().Count);
            source.Verify(e => e.Disconnect());
            e1.Verify(e => e.Disconnect());
            e2.Verify(e => e.Disconnect());
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:18,代码来源:EnviromentRepositoryTest.cs

示例11: EnvironmentRepositoryAllExpectedReturnsAllItems

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

            var repo = new TestEnvironmentRespository(source.Object, e1.Object, e2.Object);
            Assert.AreEqual(3, repo.All().Count);
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:9,代码来源:EnviromentRepositoryTest.cs


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