Пример #1
0
        public void TestCreateAssetMissingKey()
        {
            var createdBy = "0x9687a70513047dc6Ee966D69bD0C07FFb1102098";

            var sdk    = new AmbrosusSdk(new AmbrosusSettings());
            var assets = sdk.CreateAsset();
        }
Пример #2
0
        public void TestGetAssetById()
        {
            var sdk   = new AmbrosusSdk(new AmbrosusSettings());
            var asset = sdk.GetAssetById(_assetId);

            Assert.IsNotNull(asset);
            Assert.IsTrue(asset.AssetId == _assetId);
        }
Пример #3
0
        public void TestGetEventWithDefaultParamters()
        {
            var sdk    = new AmbrosusSdk(new AmbrosusSettings());
            var events = sdk.GetEvents(new EventOptions());

            Assert.IsTrue(events.ResultCount > 1);
            Assert.IsTrue(events.Results.Count > 1);
        }
Пример #4
0
        public void TestNodeInformation()
        {
            var sdk      = new AmbrosusSdk(new AmbrosusSettings());
            var nodeInfo = sdk.GetNodeInfo();

            Assert.IsFalse(string.IsNullOrEmpty(nodeInfo.NodeAddress));
            Assert.IsFalse(string.IsNullOrEmpty(nodeInfo.Version));
        }
Пример #5
0
        public void TestSdkInstantionation()
        {
            var settings = new AmbrosusSettings();
            var sdk      = new AmbrosusSdk(settings);

            Assert.IsFalse(string.IsNullOrEmpty(sdk.Settings.ApiEndpoint));
            Assert.IsTrue(sdk.Settings.ApiEndpoint == settings.ApiEndpoint);
        }
Пример #6
0
 public MainPage()
 {
     this.InitializeComponent();
     _sdk = new AmbrosusSdk(new AmbrosusSettings
     {
     });
     var info  = _sdk.GetNodeInfo();
     var asset = _sdk.CreateAsset();
 }
Пример #7
0
        public void TestGetAssetWithEmptyParamaters()
        {
            var sdk    = new AmbrosusSdk(new AmbrosusSettings());
            var assets = sdk.GetAssets(new AssetOptions
            {
            });

            Assert.IsTrue(assets.ResultCount > 1);
            Assert.IsTrue(assets.Results.Count > 1);
        }
Пример #8
0
 public void TestGetEventWithInvalidParamters()
 {
     var sdk = new AmbrosusSdk(new AmbrosusSettings());
     var eve = sdk.GetEvents(new EventOptions
     {
         CreatedBy = "0x32423",
         PerPage   = 5,
         AssetId   = "0x3432423",
     });
 }
Пример #9
0
        /// <summary>
        /// Initializes the singleton application object.  This is the first line of authored code
        /// executed, and as such is the logical equivalent of main() or WinMain().
        /// </summary>
        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;

            var sdk = new AmbrosusSdk(new AmbrosusSettings
            {
                ApiEndpoint = "https://gateway-test.ambrosus.com",
            });
            var nodeinfo = sdk.GetNodeInfo();
        }
Пример #10
0
        public void TestGetAssetWithInvalidParamaters()
        {
            var createdBy = "0x9687a70518";

            var sdk    = new AmbrosusSdk(new AmbrosusSettings());
            var assets = sdk.GetAssets(new AssetOptions
            {
                PerPage   = 10,
                CreatedBy = createdBy
            });
        }
Пример #11
0
 public void TestCreateEventInvalidSecret()
 {
     var assetId = "0x525466324f178cef08e25cf69cffde9f149129e4ceddfaa19767bc29705cef56";
     var sdk     = new AmbrosusSdk(new AmbrosusSettings());
     var eve     = sdk.CreateEvent(assetId, new List <Datum>
     {
         new Datum
         {
             Type           = EventType.Temperature.Value,
             AdditionalData = new Dictionary <string, JToken>
             {
                 { "temperature", "15" }
             }
         }
     });
 }
Пример #12
0
        public void TestGetEventWithSpecificParamters()
        {
            var assetId = "0x525466324f178cef08e25cf69cffde9f149129e4ceddfaa19767bc29705cef56";
            var sdk     = new AmbrosusSdk(new AmbrosusSettings());
            var events  = sdk.GetEvents(new EventOptions
            {
                PerPage = 5,
                AssetId = assetId
            });

            Assert.IsTrue(events.Results.Count == 5);
            foreach (var eventsResult in events.Results)
            {
                Assert.IsTrue(eventsResult.Content.IdData.AssetId == assetId);
            }
        }
Пример #13
0
        public void TestGetEventById()
        {
            var sdk = new AmbrosusSdk(new AmbrosusSettings());
            var eve = sdk.GetEventById(_eventId);

            Assert.IsTrue(eve.EventId == _eventId);
            foreach (var datum in eve.Content.Data)
            {
                Assert.IsNotNull(datum.AdditionalData);
                foreach (var d in datum.AdditionalData)
                {
                    Assert.IsNotNull(d.Key);
                    Assert.IsNotNull(d.Value);
                }
            }
        }
Пример #14
0
        public void TestGetAssetWithParamaters()
        {
            var createdBy = "0x9687a70513047dc6Ee966D69bD0C07FFb1102098";

            var sdk    = new AmbrosusSdk(new AmbrosusSettings());
            var assets = sdk.GetAssets(new AssetOptions
            {
                PerPage   = 10,
                CreatedBy = createdBy
            });

            Assert.IsTrue(assets.Results.Count == 10);
            foreach (var assetsResult in assets.Results)
            {
                Assert.IsTrue(assetsResult.Content.IdData.CreatedBy == createdBy);
            }
        }
Пример #15
0
 public void TestGetAssetWithMissingId()
 {
     var sdk   = new AmbrosusSdk(new AmbrosusSettings());
     var asset = sdk.GetAssetById("");
 }
Пример #16
0
 public void TestCreateEventEmptyAssetId()
 {
     var sdk = new AmbrosusSdk(new AmbrosusSettings());
     var eve = sdk.CreateEvent("", new List <Datum>());
 }
Пример #17
0
 public void TestGetAssetWithInvalidAssetId()
 {
     var sdk   = new AmbrosusSdk(new AmbrosusSettings());
     var asset = sdk.GetAssetById("0x34234232");
 }
Пример #18
0
 public void TestGetEventWithInvalidId()
 {
     var sdk = new AmbrosusSdk(new AmbrosusSettings());
     var eve = sdk.GetEventById("0x34234232");
 }
Пример #19
0
 public void TestGetEventByWithEmptyId()
 {
     var sdk = new AmbrosusSdk(new AmbrosusSettings());
     var eve = sdk.GetEventById("");
 }
Пример #20
0
 public void TestCreateEventEmptyData()
 {
     var assetId = "0x525466324f178cef08e25cf69cffde9f149129e4ceddfaa19767bc29705cef56";
     var sdk     = new AmbrosusSdk(new AmbrosusSettings());
     var eve     = sdk.CreateEvent(assetId, new List <Datum>());
 }