public void TestFluentInterface()
        {
            IDataFacade facade      = new CollectionDataFacade();
            var         currentRows = facade.ExecuteQuery(null).Count();

            //  连续添加记录
            facade
            .AddNewCurrency("CNY", "人民币元")
            .AddNewCurrency("USD", "美元")
            .AddNewCurrency("JPY", "日圆")
            .AddNewCurrency("HKD", "港元")
            .AddNewCurrency("FRF", "法郎")
            .AddNewCurrency("GBP", "英镑");

            Assert.AreEqual <int>(currentRows + 6, facade.ExecuteQuery(null).Count());

            //  连续添加记录
            facade
            .AddNewCurrency("DW1", "Known1")
            .AddNewCurrency("DW2", "Known2")
            .AddNewCurrency("DW3", "Known3")
            .AddNewCurrency("DW4", "Known4")
            .AddNewCurrency("DW5", "Known5");
            Assert.AreEqual <int>(5, facade.ExecuteQuery((x) => { return(x.Code.StartsWith("DW")); }).Count());
        }
Exemplo n.º 2
0
        public void TestFluentInterface()
        {
            IDataFacade facade      = new CollectionDataFacade();
            var         currentRows = facade.ExecuteQuery(null).Count();

            facade.AddNewCurrency("CNY", "Renmingbing")
            .AddNewCurrency("USD", "USD")
            .AddNewCurrency("JPY", "JPY")
            .AddNewCurrency("HKD", "HKD")
            .AddNewCurrency("FRF", "FRF")
            .AddNewCurrency("GBP", "GBP");
            Assert.AreEqual <int>(currentRows + 6, facade.ExecuteQuery(null).Count());

            facade.AddNewCurrency("DW1", "Known1")
            .AddNewCurrency("DW2", "Known2")
            .AddNewCurrency("DW3", "Known3")
            .AddNewCurrency("DW4", "Known4")
            .AddNewCurrency("DW5", "Known5")
            .AddNewCurrency("DW6", "Known6");

            Assert.AreEqual <int>(6, facade.ExecuteQuery(p => p.Code.StartsWith("DW")).Count());
        }