public void AddToMutationState_TwoRealTokens_CombinesTokens() { // Arrange var bucket = new Mock <IBucket>(); bucket.SetupGet(m => m.Name).Returns("default"); var db = new BucketContext(bucket.Object); var token1 = new MutationToken("default", 1, 2, 3); var token2 = new MutationToken("default", 4, 5, 6); // Act db.AddToMutationState(token1); db.AddToMutationState(token2); // Assert Assert.IsNotNull(db.MutationState); var tokens = MutationStateToList(db.MutationState); Assert.AreEqual(2, tokens.Count); Assert.Contains(token1, tokens); Assert.Contains(token2, tokens); }
public void AddToMutationState_FirstRealTokenThenDefaultToken_DoesNothing() { // Arrange var bucket = new Mock <IBucket>(); bucket.SetupGet(m => m.Name).Returns("default"); var db = new BucketContext(bucket.Object); var token = new MutationToken("default", 1, 2, 3); db.AddToMutationState(token); // Act db.AddToMutationState(new MutationToken("default", -1, -1, -1)); // Assert Assert.IsNotNull(db.MutationState); var tokens = MutationStateToList(db.MutationState); Assert.AreEqual(1, tokens.Count); Assert.Contains(token, tokens); }
public void AddToMutationState_FirstRealTokenThenNull_DoesNothing() { // Arrange var bucket = new Mock<IBucket>(); bucket.SetupGet(m => m.Name).Returns("default"); var db = new BucketContext(bucket.Object); var token = new MutationToken("default", 1, 2, 3); db.AddToMutationState(token); // Act db.AddToMutationState(null); // Assert Assert.IsNotNull(db.MutationState); var tokens = MutationStateToList(db.MutationState); Assert.AreEqual(1, tokens.Count); Assert.Contains(token, tokens); }
public void AddToMutationState_DefaultToken_DoesNothing() { // Arrange var bucket = new Mock<IBucket>(); bucket.SetupGet(m => m.Name).Returns("default"); var db = new BucketContext(bucket.Object); // Act db.AddToMutationState(new MutationToken("default", -1, -1, 1)); // Assert Assert.IsNull(db.MutationState); }
public void AddToMutationState_DefaultToken_DoesNothing() { // Arrange var bucket = new Mock <IBucket>(); bucket.SetupGet(m => m.Name).Returns("default"); var db = new BucketContext(bucket.Object); // Act db.AddToMutationState(new MutationToken("default", -1, -1, 1)); // Assert Assert.IsNull(db.MutationState); }
public void AddToMutationState_TokenWithSequenceNumberLessThan1_DoesNothing() { // Arrange var bucket = new Mock <IBucket>(); bucket.SetupGet(m => m.Name).Returns("default"); var db = new BucketContext(bucket.Object); // Act db.AddToMutationState(new MutationToken("default", 1, 2, 0)); // Assert Assert.IsNull(db.MutationState); }
public void ResetMutationState_HasState_SetsToNull() { // Arrange var bucket = new Mock <IBucket>(); bucket.SetupGet(m => m.Name).Returns("default"); var db = new BucketContext(bucket.Object); db.AddToMutationState(new MutationToken("default", 1, 2, 3)); Assert.NotNull(db.MutationState); // Act db.ResetMutationState(); // Assert Assert.Null(db.MutationState); }
public void ResetMutationState_HasState_SetsToNull() { // Arrange var bucket = new Mock<IBucket>(); bucket.SetupGet(m => m.Name).Returns("default"); var db = new BucketContext(bucket.Object); db.AddToMutationState(new MutationToken("default", 1, 2, 3)); Assert.NotNull(db.MutationState); // Act db.ResetMutationState(); // Assert Assert.Null(db.MutationState); }
public void AddToMutationState_TwoRealTokens_CombinesTokens() { // Arrange var bucket = new Mock<IBucket>(); bucket.SetupGet(m => m.Name).Returns("default"); var db = new BucketContext(bucket.Object); var token1 = new MutationToken("default", 1, 2, 3); var token2 = new MutationToken("default", 4, 5, 6); // Act db.AddToMutationState(token1); db.AddToMutationState(token2); // Assert Assert.IsNotNull(db.MutationState); var tokens = MutationStateToList(db.MutationState); Assert.AreEqual(2, tokens.Count); Assert.Contains(token1, tokens); Assert.Contains(token2, tokens); }