public async Task SubmitPersonalIndo_DuplicateNameUniqueAddress_AddsRecordToDb()
        {
            var sutSetup = new SutSetup();
            var sut      = sutSetup.CreateSut();

            await sut.SubmitPersonalInfo(sutSetup.DuplicateInfoWithUniqueAddress);

            Assert.That(sutSetup.Database.PersonalInfo.Count() == 2);
        }
        public async Task SubmitPersonalIndo_DuplicateNameAndAddress_NothingHappens()
        {
            var sutSetup = new SutSetup();
            var sut      = sutSetup.CreateSut();

            await sut.SubmitPersonalInfo(sutSetup.DuplicateInfo);

            Assert.That(sutSetup.Database.PersonalInfo.Count() == 1);
        }
        public async Task SubmitPersonalInfo_NoDuplication_AddsRecordToDb()
        {
            var sutSetup = new SutSetup();
            var sut      = sutSetup.CreateSut();

            await sut.SubmitPersonalInfo(sutSetup.UniquePersonalInfo);

            Assert.That(sutSetup.Database.PersonalInfo.Count() == 2);
        }
        public void Constructor_NullContext_ThrowsArgumentNullException()
        {
            var sutSetup = new SutSetup()
            {
                Database = null
            };

            Assert.Throws <ArgumentNullException>(() => sutSetup.CreateSut());
        }
Ejemplo n.º 5
0
        public void OnGet_ExecutesGetCitiesQueryAndReturnsPage()
        {
            var sutSetup = new SutSetup();

            var result = sutSetup.CreateSut().OnGet();

            Assert.That(sutSetup.GetExecuted);
            Assert.That(result is PageResult);
        }
Ejemplo n.º 6
0
        public async Task OnPostAsync_InValidModel_ReturnsPage()
        {
            var sutSetup = new SutSetup();
            var sut      = sutSetup.CreateSut();

            sut.PersonalInfo = null;
            sut.ModelState.AddModelError("PersonalInfo.FirstName", "FieldRequired");

            var result = await sut.OnPostAsync();

            Assert.That(!sutSetup.SubmitExecuted);
            Assert.That(result is PageResult);
        }
Ejemplo n.º 7
0
        public async Task OnPostAsync_ValidModel_SubmitsModelRedirectsToThankYou()
        {
            var sutSetup = new SutSetup();
            var sut      = sutSetup.CreateSut();

            sut.PersonalInfo = sutSetup.ValidModel;

            var result = await sut.OnPostAsync() as RedirectToPageResult;

            Assert.That(sutSetup.SubmitExecuted);
            Assert.That(result != null);
            Assert.That(result.PageName == "ThankYou");
        }