Dev2.Core.Tests.DebugStateTreeViewItemViewModelTests.DebugStateTreeViewItemViewModel_Constructor_EnvironmentRepository_SetsDebugStateServer C# (CSharp) 메소드

DebugStateTreeViewItemViewModel_Constructor_EnvironmentRepository_SetsDebugStateServer() 개인적인 메소드

        public void DebugStateTreeViewItemViewModel_Constructor_EnvironmentRepository_SetsDebugStateServer()
        {
            var environmentID = Guid.NewGuid();
            const string ServerName = "Myserver";

            var env = new Mock<IEnvironmentModel>();
            env.Setup(e => e.ID).Returns(environmentID);
            env.Setup(e => e.Name).Returns(ServerName);

            var env2 = new Mock<IEnvironmentModel>();
            env2.Setup(e => e.ID).Returns(Guid.NewGuid());

            var envRep = new Mock<IEnvironmentRepository>();
            envRep.Setup(e => e.All()).Returns(() => new[] { env.Object, env2.Object });

            var content = new DebugState { EnvironmentID = environmentID };
            // ReSharper disable ObjectCreationAsStatement
            new DebugStateTreeViewItemViewModelMock(envRep.Object) { Content = content };
            // ReSharper restore ObjectCreationAsStatement
            Assert.AreEqual(ServerName, content.Server);
        }
DebugStateTreeViewItemViewModelTests