public void AddBalancingPost_Amount_AddsNegatedAmountIfFirst() { Post post = new Post(); AddBalancingPost addBalancingPost1 = new AddBalancingPost(new Xact(), post); Amount amount = new Amount(10); addBalancingPost1.Amount(amount); Assert.False(addBalancingPost1.First); Assert.Equal(-10, addBalancingPost1.NullPost.Amount.Quantity.ToLong()); Assert.True(addBalancingPost1.NullPost.Flags.HasFlag(SupportsFlagsEnum.POST_CALCULATED)); }
public void AddBalancingPost_Amount_UpdatesPostAmountIfNotFirst() { Post post = new Post() { State = ItemStateEnum.Pending }; AddBalancingPost addBalancingPost1 = new AddBalancingPost(new Xact(), post); Amount amount = new Amount(10); addBalancingPost1.Amount(amount); Amount amount1 = new Amount(5); addBalancingPost1.Amount(amount1); Post result = addBalancingPost1.Xact.Posts.First(); Assert.Equal(-5, result.Amount.Quantity.ToLong()); Assert.True(result.Flags.HasFlag(SupportsFlagsEnum.POST_CALCULATED)); Assert.True(result.Flags.HasFlag(SupportsFlagsEnum.ITEM_GENERATED)); Assert.Equal(post.State, addBalancingPost1.NullPost.State); }