コード例 #1
0
ファイル: SkyBillTests.cs プロジェクト: Skeldave/SkyBill
        public void IsTheBillJsonAvailable()
        {
            //Instantiate our home controller
            HomeController controller = new HomeController();

            //Attempt to download the bill
            string billJson = controller.DownloadBill();

            //Make sure the bill successfully downloaded
            Assert.IsNotNullOrEmpty(billJson);
        }
コード例 #2
0
ファイル: SkyBillTests.cs プロジェクト: Skeldave/SkyBill
        public void IsTheBillFullyPopulated()
        {
            //Instantiate our home controller
            HomeController controller = new HomeController();

            //Attempt to download the bill
            string billJson = controller.DownloadBill();

            //Create an output exception, should return null if deserialization happened correctly
            JsonSerializationException serializationFailedException;

            //Attempt to deserialize the json into a Bill class
            Bill bill = controller.DeserializeJson(billJson, out serializationFailedException);

            //Bill Class Tests
            Assert.IsNotNull(bill.statement);
            Assert.IsNotNull(bill.package);
            Assert.IsNotNull(bill.callCharges);
            Assert.IsNotNull(bill.skyStore);

            //Statement Class Tests
            Assert.IsNotNull(bill.statement.generated);
            Assert.IsNotNull(bill.statement.due);
            Assert.IsNotNull(bill.statement.period);

            //Period Class Tests
            Assert.IsNotNull(bill.statement.period.from);
            Assert.IsNotNull(bill.statement.period.to);

            //Package Class Tests
            Assert.Greater(bill.package.subscriptions.Count, 0);

            //Subscription Class Tests
            Assert.That(bill.package.subscriptions.All(x => !string.IsNullOrWhiteSpace(x.type)));
            Assert.That(bill.package.subscriptions.All(x => !string.IsNullOrWhiteSpace(x.name)));

            //CallCharges Class Tests
            Assert.That(bill.callCharges.calls.All(x => !string.IsNullOrEmpty(x.called)));
            Assert.That(bill.callCharges.calls.All(x => !string.IsNullOrEmpty(x.duration.ToString())));

            //SkyStore Class Tests
            Assert.That(bill.skyStore.rentals.All(x => !string.IsNullOrWhiteSpace(x.title)));
            Assert.That(bill.skyStore.buyAndKeep.All(x => !string.IsNullOrWhiteSpace(x.title)));
        }
コード例 #3
0
ファイル: SkyBillTests.cs プロジェクト: Skeldave/SkyBill
        public void IsTheBillValidJson()
        {
            //Instantiate our home controller
            HomeController controller = new HomeController();

            //Attempt to download the bill
            string billJson = controller.DownloadBill();

            //Create an output exception, should return null if deserialization happened correctly
            JsonSerializationException serializationFailedException;

            //Attempt to deserialize the json into a Bill class
            Bill bill = controller.DeserializeJson(billJson, out serializationFailedException);

            //Test whether the bill deserialized properly
            Assert.IsNotNull(bill, "The bill failed to deserialize properly");

            //Test whether an exception was thrown during deserialization
            Assert.IsNull(serializationFailedException);
        }