public void TestFromModel() { //arrange var dbSourceMock = new Mock <IDbSource>(); var expectedResourceName = "expectedResourceName"; var expectedAuthenticationType = AuthenticationType.Windows; var expectedUserName = "******"; var dbSourceServerName = "dbSoureServerName"; var dbSourceType = enSourceType.DynamicService; var expectedPassword = "******"; var expectedPath = "expectedPath"; var expectedServerName = new ComputerName() { Name = dbSourceServerName }; _targetAsyncWorker.ComputerNames = new List <ComputerName> { expectedServerName }; var expectedDatabaseName = "expectedDatabaseName"; dbSourceMock.SetupGet(it => it.Name).Returns(expectedResourceName); dbSourceMock.SetupGet(it => it.AuthenticationType).Returns(expectedAuthenticationType); dbSourceMock.SetupGet(it => it.UserName).Returns(expectedUserName); dbSourceMock.SetupGet(it => it.ServerName).Returns(dbSourceServerName); dbSourceMock.SetupGet(it => it.Password).Returns(expectedPassword); dbSourceMock.SetupGet(it => it.Path).Returns(expectedPath); dbSourceMock.SetupGet(it => it.Type).Returns(dbSourceType); dbSourceMock.SetupGet(it => it.DbName).Returns(expectedDatabaseName); _changedPropertiesAsyncWorker.Clear(); //act _targetAsyncWorker.FromModel(dbSourceMock.Object); //assert Assert.AreEqual(expectedResourceName, _targetAsyncWorker.ResourceName); Assert.AreEqual(expectedAuthenticationType, _targetAsyncWorker.AuthenticationType); Assert.AreEqual(expectedUserName, _targetAsyncWorker.UserName); Assert.AreSame(expectedServerName, _targetAsyncWorker.ServerName); Assert.AreEqual(dbSourceServerName, _targetAsyncWorker.EmptyServerName); Assert.AreEqual(expectedPassword, _targetAsyncWorker.Password); Assert.AreEqual(expectedPath, _targetAsyncWorker.Path); Assert.AreEqual(expectedDatabaseName, _targetAsyncWorker.DatabaseName); Assert.IsTrue(_changedPropertiesAsyncWorker.Contains("DatabaseNames")); }