本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
示例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");
}
示例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");
}
示例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);
}
示例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);
}