public void VersionStrategy_GetNextVersion_OldResourceNull_ExpectVersion1() { //------------Setup for test-------------------------- var versionStrategy = new VersionStrategy(); //------------Execute Test--------------------------- var output =versionStrategy.GetNextVersion(new Mock<IResource>().Object, null, "bob", "save"); //------------Assert Results------------------------- Assert.AreEqual(output.VersionNumber,"1"); Assert.AreEqual(output.Reason,"save"); Assert.AreEqual(output.User,"bob"); Assert.AreEqual(output.DateTimeStamp.Date,DateTime.Today); }
public void VersionStrategy_GetNextVersion_OldResourceNull_Expectincremented() { //------------Setup for test-------------------------- var versionStrategy = new VersionStrategy(); var oldResource = new Mock<IResource>(); var id = Guid.NewGuid(); var ver = Guid.NewGuid(); oldResource.Setup(a=>a.VersionInfo).Returns(new VersionInfo(DateTime.Now,"mook","usr","1",id,ver)); //------------Execute Test--------------------------- var output = versionStrategy.GetNextVersion(new Mock<IResource>().Object, oldResource.Object, "bob", "save"); //------------Assert Results------------------------- Assert.AreEqual(output.VersionNumber, "2"); Assert.AreEqual(output.Reason, "save"); Assert.AreEqual(output.User, "bob"); Assert.AreEqual(output.DateTimeStamp.Date, DateTime.Today); }
public void VersionStrategy_GetCurrentVersion_OldResourceNull_GetVersion1() { //------------Setup for test-------------------------- var versionStrategy = new VersionStrategy(); //------------Execute Test--------------------------- var output = versionStrategy.GetCurrentVersion(null, new VersionInfo(DateTime.Now, "bob", "dave", "1", Guid.Empty, Guid.Empty), "bob", "save"); //------------Assert Results------------------------- Assert.AreEqual(output.VersionNumber, "2"); Assert.AreEqual(output.Reason, "save"); Assert.AreEqual(output.User, "bob"); Assert.AreEqual(output.DateTimeStamp.Date, DateTime.Today); }