public void Dynamic_Mutation()
        {
            // arrange
            var colName   = "This is a test name";
            var col1      = "Test1";
            var colValue1 = 300M;
            var col2      = "Test2";
            var colValue2 = "Hello";

            // act
            dynamic actual = new FluentSuperColumn <AsciiType, AsciiType>();

            actual.ColumnName = colName;
            actual.Test1      = colValue1;
            actual.Test2      = colValue2;

            // assert
            var mutations = ((IFluentRecord)actual).MutationTracker.GetMutations();

            Assert.Equal(2, mutations.Count());
            Assert.Equal(2, mutations.Count(x => x.Type == MutationType.Added));

            var mut1 = mutations.FirstOrDefault(x => x.Column.ColumnName == col1);
            var mut2 = mutations.FirstOrDefault(x => x.Column.ColumnName == col2);

            Assert.NotNull(mut1);
            Assert.NotNull(mut2);

            Assert.Same(actual, mut1.Column.GetParent().SuperColumn);
            Assert.Same(actual, mut2.Column.GetParent().SuperColumn);
        }
        public void Mutation()
        {
            // arrange
            var colName = "This is a test name";
            var col1    = new FluentColumn <AsciiType> {
                ColumnName = "Test1", ColumnValue = 300M
            };
            var col2 = new FluentColumn <AsciiType> {
                ColumnName = "Test2", ColumnValue = "Hello"
            };

            // act
            var actual = new FluentSuperColumn <AsciiType, AsciiType>();

            actual.ColumnName = colName;
            actual.Columns.Add(col1);
            actual.Columns.Add(col2);

            // assert
            var mutations = actual.MutationTracker.GetMutations();

            Assert.Equal(2, mutations.Count());
            Assert.Equal(2, mutations.Count(x => x.Type == MutationType.Added));

            var mut1 = mutations.FirstOrDefault(x => x.Column.ColumnName == "Test1");
            var mut2 = mutations.FirstOrDefault(x => x.Column.ColumnName == "Test2");

            Assert.Same(col1, mut1.Column);
            Assert.Same(col2, mut2.Column);

            Assert.Same(actual, mut1.Column.GetParent().SuperColumn);
            Assert.Same(actual, mut2.Column.GetParent().SuperColumn);
        }
        public void Path_Set()
        {
            // arrange

            // act
            var actual = new FluentSuperColumn <AsciiType, AsciiType>();

            // assert
            Assert.Same(actual, actual.GetPath().SuperColumn);
        }
        public void Get_NonExistent_Column()
        {
            // arrange
            var colName   = "This is a test name";
            var colValue1 = 300M;
            var colValue2 = "Hello";
            var expected  = (string)null;

            // act
            dynamic superColumn = new FluentSuperColumn <AsciiType, AsciiType>();

            superColumn.Name  = colName;
            superColumn.Test1 = colValue1;
            superColumn.Test2 = colValue2;
            var actual = superColumn.Test3;

            // assert
            Assert.Equal(expected, (string)actual);
        }
Exemplo n.º 5
0
        public void Get_NonExistent_Column()
        {
            // arrange
            var col1 = new FluentSuperColumn <AsciiType, AsciiType> {
                ColumnName = "Test1"
            };
            var col2 = new FluentSuperColumn <AsciiType, AsciiType> {
                ColumnName = "Test2"
            };

            // act
            dynamic family = new FluentSuperColumnFamily <AsciiType, AsciiType>("Keyspace1", "Standard1");

            family.Test1 = col1;
            family.Test2 = col2;
            var actual = family.Test3;

            // assert
            Assert.IsType(typeof(FluentSuperColumn), actual);
        }
Exemplo n.º 6
0
        public void Constructor_Test()
        {
            // arrange
            var col1 = new FluentSuperColumn <AsciiType, AsciiType> {
                ColumnName = "Test1"
            };
            var col2 = new FluentSuperColumn <AsciiType, AsciiType> {
                ColumnName = "Test2"
            };

            // act
            var actual = new FluentSuperColumnFamily <AsciiType, AsciiType>("Keyspace1", "Standard1");

            actual.Columns.Add(col1);
            actual.Columns.Add(col2);

            // assert
            Assert.Equal(2, actual.Columns.Count);
            Assert.Same(col1.Family, actual);
            Assert.Same(col2.Family, actual);
        }
        public void Constructor_Test()
        {
            // arrange
            var colName = "This is a test name";
            var col1    = new FluentColumn <AsciiType> {
                ColumnName = "Test1", ColumnValue = 300M
            };
            var col2 = new FluentColumn <AsciiType> {
                ColumnName = "Test2", ColumnValue = "Hello"
            };

            // act
            var actual = new FluentSuperColumn <AsciiType, AsciiType>();

            actual.ColumnName = colName;
            actual.Columns.Add(col1);
            actual.Columns.Add(col2);

            // assert
            Assert.Equal(colName, (string)actual.ColumnName);
            Assert.Equal(2, actual.Columns.Count);
        }
Exemplo n.º 8
0
        public void Constructor_Dynamic_Test()
        {
            // arrange
            var col1 = new FluentSuperColumn <AsciiType, AsciiType> {
                ColumnName = "Test1"
            };
            var col2 = new FluentSuperColumn <AsciiType, AsciiType> {
                ColumnName = "Test2"
            };

            // act
            dynamic actual = new FluentSuperColumnFamily <AsciiType, AsciiType>("Keyspace1", "Standard1");

            actual.Test1 = col1;
            actual.Test2 = col2;

            // assert
            Assert.Equal(col1, actual.Test1);
            Assert.Equal(col1, actual["Test1"]);
            Assert.Equal(col2, actual.Test2);
            Assert.Equal(col2, actual["Test2"]);
            Assert.Same(col1.Family, actual);
            Assert.Same(col2.Family, actual);
        }
        public void Constructor_Dynamic_Test()
        {
            // arrange
            var colName   = "This is a test name";
            var col1      = "Test1";
            var colValue1 = 300M;
            var col2      = "Test2";
            var colValue2 = "Hello";

            // act
            dynamic actual = new FluentSuperColumn <AsciiType, AsciiType>();

            actual.Name  = colName;
            actual.Test1 = colValue1;
            actual.Test2 = colValue2;

            // assert
            Assert.Equal(colName, (string)actual.Name);
            //Assert.Equal(2, actual.Columns.CountColumns);
            Assert.Equal(colValue1, (decimal)actual.Test1);
            Assert.Equal(colValue1, (decimal)actual[col1]);
            Assert.Equal(colValue2, (string)actual.Test2);
            Assert.Equal(colValue2, (string)actual[col2]);
        }
Exemplo n.º 10
0
 public FluentColumnPath(IFluentBaseColumnFamily columnFamily, FluentSuperColumn superColumn, FluentCounterColumn column)
     : base(columnFamily, superColumn)
 {
     CounterColumn = column;
 }
Exemplo n.º 11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="columnFamily"></param>
 /// <param name="superColumn"></param>
 /// <param name="column"></param>
 public FluentColumnParent(IFluentBaseColumnFamily columnFamily, FluentSuperColumn superColumn)
 {
     ColumnFamily = columnFamily;
     SuperColumn  = superColumn;
 }