GetNextVersion() public method

public GetNextVersion ( IResource newResource, IResource oldResource, string userName, string reason ) : IVersionInfo
newResource IResource
oldResource IResource
userName string
reason string
return IVersionInfo
コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }